Kozea/Pyphen

'uni' considered one syllable

adammichaelwood opened this issue · 4 comments

>>> dic = pyphen.Pyphen(lang='en_US')
>>> dic.inserted("universal")
'uni-ver-sal'
>>> dic.inserted("university")
'uni-ver-si-ty'
>>> dic.inserted("universe")
'uni-verse'
>>> dic.inserted("uni")
'uni'
liZe commented

Hello @adammichaelwood, thank you for taking the time to report this issue.

There are two parameters called left and right in Pyphen.__init__, fixing the minimum of characters in the first and last syllabes. As their default values are 2, you get this behaviour. You can use 1 to fix your problem.

>>> dic = pyphen.Pyphen(lang='en_US', left=1, right=1)
>>> dic.inserted("universal")
'u-ni-ver-sal'

I've added a paragraph in the documentation about using help(pyphen) to get the whole documentation of the API.

Thanks for the tip!

When I do that I still get 'even' instead of 'e-ven' and now I get also 'y-our' instead of 'your'.

liZe commented

When I do that I still get 'even' instead of 'e-ven' and now I get also 'y-our' instead of 'your'.

The English dictionary is intended to be used with left=2 and right=3, so we can assume that 1) it doesn’t include hyphenations with less letters like e-ven, and 2) using lower values will give random unwanted hyphenations like y-our.