Skip to content

Instantly share code, notes, and snippets.

@youknowone
Created January 28, 2016 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youknowone/8dea02c727cc962f3244 to your computer and use it in GitHub Desktop.
Save youknowone/8dea02c727cc962f3244 to your computer and use it in GitHub Desktop.
>>> from korean import Noun, NumberWord, Loanword
>>> fmt = u'{subj:은} {obj:을} 먹었다.'
>>> print fmt.format(subj=Noun(u'나'), obj=Noun(u'밥'))
나는 밥을 먹었다.
>>> print fmt.format(subj=Noun(u'나'), obj=Noun(u'bob'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "korean/morphology/substantive.py", line 38, in __format__
text = merge(self, Particle(separated_spec.pop(0)))
File "korean/morphology/__init__.py", line 77, in merge
suffix = cls.pick_allomorph(suffix, suffix_of=prefix)
File "korean/morphology/__init__.py", line 68, in pick_allomorph
return bound_func(prefix_of or suffix_of)
File "korean/morphology/particle.py", line 103, in pick_allomorph_after_substantive
return self.pick_allomorph_after_char(substantive.read()[-1])
File "korean/morphology/particle.py", line 91, in pick_allomorph_after_char
final = hangul.get_final(char)
File "korean/hangul.py", line 95, in get_final
return FINALS[char_offset(char) % len(FINALS)]
File "korean/hangul.py", line 44, in char_offset
assert is_hangul(char)
AssertionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment