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]:
In [12]:
print(etree.tostring(output[0][1]))
In [19]:
for i in output.iter():
if 'lemma' in i.attrib:
print((i.attrib['lemma']))
In [50]:
print('español')