Kozea / Pyphen

Hy-phen-ation made easy
https://courtbouillon.org/pyphen
Other
198 stars 24 forks source link

hyphen symbol at the beginning #45

Closed timbrookers closed 1 year ago

timbrookers commented 1 year ago

Dear All

I am using pyphen in Mongolian Language. I do have issue that the hyphen symbol is appearing at the beginning. Here is the result:

На|ран |Лув|сан ах о|лон |со|нин |хэв|лэ|нэ. |На|ран |сай|хан |ном |со|нин ав|лаа. Э|нэ |со|нин Ү|нэн |со|нин. |Хэр|лэн өөр о|лон |ном |со|нин ун|шив. |На|сан |ха|вар, |на|мар о|лон |со|нин ав|сан. Э|нэ |со|нин |хо|вор. |Ха|вар |мал өс|лөө. |Мо|лом |мал |мал|лав. |Ло|сол |ма|лаа ус|лав. |Ма|рал үх|рээ |ху|раа|лаа. Ө|вөө ү|хэр |ма|лаа |ху|раа|лаа. Э|мээ |мах |сүү а|вав. Ах |мал |мал|лав

As i am new for python, it might be that i had missed something.

Awaiting for your kind support

liZe commented 1 year ago

Hi!

Pyphen’s functions can only be used with words, not full sentences. You can for example use this code:

import pyphen
dic = pyphen.Pyphen(lang='mn_MN')
[dic.inserted(word) for word in 'Наран Лувсан ах олон сонин хэвлэнэ'.split()]

This code is not perfect, because it doesn’t take care of the punctuation marks, but that’s a good sample to understand how Pyphen works.

timbrookers commented 1 year ago

Hi, Well noted. That's totally fine. important is the result that shows the syllables.

One more thing i would like to ask. Is it possible to add some code for highlighting the syllables, for example with different colors?

Thank you in advance