dr-leo / PyHyphen

Other
10 stars 5 forks source link

IndexError #20

Open pmantyla opened 1 year ago

pmantyla commented 1 year ago

The snippet below results in an IndexError. It seems to have trouble wrapping the last word: "ch'entrate".

from hyphen.textwrap2 import TextWrapper
import hyphen

h_en = hyphen.Hyphenator('en_US')
wrapper = TextWrapper(width=70, use_hyphenator=h_en)
print(wrapper.fill("Abandon all hope, you who enter here (Lasciate ogni speranza, voi ch'entrate)."))
pmantyla commented 1 year ago

Here's an even simpler example:

import hyphen
h_en = hyphen.Hyphenator('en_US')
h_en.wrap('self-confidence', 14)