def test_lexeme(self): # Assert all inflections of "sein". v = de.lexeme("sein") self.assertEqual( v, [ "sein", "bin", "bist", "ist", "sind", "seid", "seiend", "war", "warst", "waren", "wart", "gewesen", "sei", "seien", "seiest", "seiet", u"wäre", u"wärest", u"wären", u"wäret", ], ) print "pattern.de.inflect.lexeme()"
def test_lexeme(self): # Assert all inflections of "sein". v = de.lexeme("sein") self.assertEqual(v, [ "sein", "bin", "bist", "ist", "sind", "seid", "seiend", "war", "warst", "waren", "wart", "gewesen", "sei", "seien", "seiest", "seiet", u"wäre", u"wärest", u"wären", u"wäret" ]) print("pattern.de.inflect.lexeme()")
# Author: Devon Fritz # Date: 30.5.15 # Stems the lexicon of german words import sys from pattern.de import lemma, lexeme reload(sys) sys.setdefaultencoding('utf-8') input_file = sys.argv[1] with open(input_file) as f: for line in f: print lemma(line.strip()) for l in lexeme(line.strip()): print l