Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method to count the number of syllables within the text #11

Closed
Smolky opened this issue Feb 2, 2018 · 1 comment
Closed

Add a method to count the number of syllables within the text #11

Smolky opened this issue Feb 2, 2018 · 1 comment

Comments

@Smolky
Copy link

Smolky commented Feb 2, 2018

It is possible to add a method to count the number of syllables within a text?

I solved my particular case this way

foreach ($syllable->histogramText ($input) as $number_of_syllables => $words_with_that_syllables) {
    $this->syllables_count += $words_with_that_syllables * $number_of_syllabes;
}

but maybe with a native method, which obtains the number of syllables, will avoid the extra work

@vanderlee
Copy link
Owner

This was pretty easy and obvious to add, so now there's a countSyllablesText() method that does exactly that. Note that numbers and such are not considered words and thus also do not count towards the syllable total.

It's in the master branch and 1.4.7 tag (so packagist will pick it up automatically).

Could you please check if this works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants