Esempio n. 1
0
# and rules for unknown words. See pattern.text.Morphology and pattern.text.Context
# for further details. A tutorial on how to acquire data for the lexicon is here:
# http://www.clips.ua.ac.be/pages/using-wiktionary-to-build-an-italian-part-of-speech-tagger

lexicon = Lexicon(
        path = os.path.join(MODULE, "xx-lexicon.txt"), 
  morphology = os.path.join(MODULE, "xx-morphology.txt"), 
     context = os.path.join(MODULE, "xx-context.txt"),
    entities = os.path.join(MODULE, "xx-entities.txt"),
    language = "xx"
)

# Create the parser with default tags for unknown words:
# (noun, proper noun, numeric).

lexicon.load()
parser = Parser(
     lexicon = lexicon,
     default = ("NN", "NNP", "CD"),
    language = "xx"
)

# Create the sentiment lexicon,
# see pattern/text/xx/xx-sentiment.xml for further details.
# We also need to define the tag for modifiers,
# words that modify the score of the following word 
# (e.g., *very* good, *not good, ...)

sentiment = Sentiment(
        path = os.path.join(MODULE, "xx-sentiment.xml"), 
      synset = None,