In [1]:
from lxml import etree
from pyfreeling import Analyzer

In [18]:
config_file = '/usr/share/freeling/config/es.cfg'
text = 'casa casado cazado'
analyzer = Analyzer(config=config_file, lang='es')
output = analyzer.run(text.encode("utf-8"), 'flush')

In [11]:
type(etree.tostring(output[0][0]))


Out[11]:
bytes

In [12]:
print(etree.tostring(output[0][1]))


b'<token id="t1.2" form="gatitos" lemma="gato" tag="NCMP00V" ctag="NC" pos="noun" type="common" gen="masculine" num="plural" degree="evaluative">\\n  </token>\\n  '

In [19]:
for i in output.iter():
    if 'lemma' in i.attrib:
        print((i.attrib['lemma']))


casa
casar
cazar

In [50]:
print('español')


español