Compiling Freeling from Python, analyzer error

Submitted by adriancampillo on Mon, 09/09/2019 - 15:37
Forums

Hello Forum,

I am working with the first example (example01.py.md) that is postered on the Freeling gitbook tutorial, but when I run the code, the analysis doesn't seem to be correct. The labels assigned to some words doesn't actually match with the real type of word. For example, some verbs are labeled as nouns.

This is the function that seem to be failing:
#! /usr/bin/python3

import pyfreeling
import sys

## -----------------------------------------------
## Do whatever is needed with analyzed sentences
## -----------------------------------------------
def ProcessSentences(ls):

# for each sentence in list
for s in ls :
# for each word in sentence
for w in s :
# print word form
print("word '"+w.get_form()+"'")
# print possible analysis in word, output lemma and tag
print(" Possible analysis: {",end="")
for a in w :
print(" ("+a.get_lemma()+","+a.get_tag()+")",end="")
print(" }")
# print analysis selected by the tagger
print(" Selected Analysis: ("+w.get_lemma()+","+w.get_tag()+")")
# sentence separator
print("")

And the a part of the result is the following:

Palabra 'alumnos'
Possible analysis: { (alumnos,NNS) }
Selected Analysis: (alumnos,NNS)
Palabra 'cuyo'
Possible analysis: { (cuyo,NN) }
Selected Analysis: (cuyo,NN)
Palabra 'grado'
Possible analysis: { (grado,NN) (grado,VBP) (grado,VB) }
Selected Analysis: (grado,NN)
Palabra 'de'
Possible analysis: { (de,NN) (de,VB) (de,VBN) (de,JJ) (de,VBD) (de,VBP) (de,RB) }
Selected Analysis: (de,NN)
Palabra 'discapacidad'
Possible analysis: { (discapacidad,NN) (discapacidad,VBD) }
Selected Analysis: (discapacidad,NN)
Palabra 'sea'
Possible analysis: { (sea,NN) }
Selected Analysis: (sea,NN)
Palabra 'leve'
Possible analysis: { (leve,VBP) (leve,VB) (leve,NN) (leve,JJ) }
Selected Analysis: (leve,VBP)
Palabra 'o'
Possible analysis: { (o,RB) (o,NN) (o,VBP) (o,VB) (o,JJ) (o,NNS) }
Selected Analysis: (o,RB)
Palabra 'moderado'
Possible analysis: { (moderado,NN) (moderado,VBP) (moderado,VB) }
Selected Analysis: (moderado,NN)
Palabra ','
Possible analysis: { (,,Fc) }
Selected Analysis: (,,Fc)
Palabra 'en'
Possible analysis: { (en,VBN) (en,RB) (en,NN) (en,NNS) (en,JJ) (en,VB) (en,VBP) }
Selected Analysis: (en,VBN)
Palabra 'las'
Possible analysis: { (las,NNS) (las,NN) (las,JJ) (las,VBD) (las,VBZ) }
Selected Analysis: (las,NNS)
Palabra 'actividades'
Possible analysis: { (actividades,NNS) (actividades,VBZ) }
Selected Analysis: (actividades,NNS)
Palabra 'dirigidas'
Possible analysis: { (dirigidas,NNS) (dirigidas,VBD) (dirigidas,VBZ) }
Selected Analysis: (dirigidas,NNS)
Palabra 'existentes'
Possible analysis: { (existentes,NNS) (existentes,VBZ) }
Selected Analysis: (existentes,NNS)
Palabra ','

I would like to know also the meaning of those small labels, that doesn't match with the labels that the analyzer gives you.

Kind regards