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

[Bug]: Wrong syllable count #195

Open
1 task done
stribor14 opened this issue Nov 29, 2022 · 2 comments
Open
1 task done

[Bug]: Wrong syllable count #195

stribor14 opened this issue Nov 29, 2022 · 2 comments
Labels

Comments

@stribor14
Copy link

Operating system

Linux

Download source

PyPi

Python distribution

Anaconda

Python version

Python 3.9.6

What happened?

When checking the results, some interesting stuff came to my attention. I was checking the return value of difficult_words for single-word inputs. To skip the part of reading through code, checking the easy_word_list in resources, etc. Here is what I found.

textstat.syllable_count("faeries") = 1
textstat.syllable_count("relived") = 3

both of those words have 2 syllables

Other information

Failing tests

def test_the_bug_i_found():
    assert (textstat.syllable_count("faeries") == 2) and (textstat.syllable_count("relived") == 2)

Code of Conduct

@stribor14 stribor14 added the bug label Nov 29, 2022
@LKirst
Copy link
Contributor

LKirst commented Nov 29, 2022

That's probably an issue with Pyphen because textstat uses Pyphen to count syllables.

@alxwrd
Copy link
Member

alxwrd commented Dec 5, 2022

That's right, we use pyphen.positions(word) to calculate syllables.

https://github.com/textstat/textstat/blob/ad80df1/textstat/textstat.py#L326L363

Although this stackexchange answer suggests that Pyphen "[is] only 54% accurate", so there might be some work to do there: https://datascience.stackexchange.com/a/89312

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

No branches or pull requests

3 participants