Package miopia :: Package analyzer :: Module Dictionary :: Class Dictionary
[hide private]
[frames] | no frames]

Class Dictionary

source code

object --+
         |
        Dictionary

A class for obtaining the semantic resources provided with MIOPIA

Instance Methods [hide private]
 
__init__(self, noun={}, adj={}, adv={}, verb={}, intd={}, lemmas={}, p_dict=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_get_words(self, name_of_dict, coding='utf-8')
Returns: A dictionary {word,semantic orientation value}
source code
 
_build_lemmas_dictionary(self, lemmas_file)
Build a nested dictionary D[lexical_category][token] to get lemmas
source code
 
adapt(self, dict_domain_info, p, n, neg_pond=0, threshold=0.5, minimum_ocurrences=1) source code
 
is_intensifier_term(self, lemma) source code
 
get_semantic_orientation(self, lemma, semantic_category)
Returns: Semantic orientation of a word
source code
 
get_psychometric_categories(self, str_word) source code
 
get_lemma(self, lexical_category, token)
Returns: The lemma of the token
source code
 
_heuristic_lemma(self, lexical_category, word)
Returns: A possible lemma of the token
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __uniqueInstance = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, noun={}, adj={}, adv={}, verb={}, intd={}, lemmas={}, p_dict=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • noun - nouns
  • adj - adjectives
  • adv - adverbs
  • verb - verbs
  • int - intensifiers
  • lemmas - lemmas
  • p_dict - A PsychometricDictionary
Overrides: object.__init__

_get_words(self, name_of_dict, coding='utf-8')

source code 
Parameters:
  • name_of_dict - The path to a semantic orientation dictionary
Returns:
A dictionary {word,semantic orientation value}

Deprecated: dictionaries should be passed as arguments to the constructor

_build_lemmas_dictionary(self, lemmas_file)

source code 

Build a nested dictionary D[lexical_category][token] to get lemmas

Parameters:
  • lemmas_file - A path to the lemmas dict file
Returns:
A nested dictionary with the lemmas

Precondition: lemmas dict must has this format: CrossTag Token Lemma

adapt(self, dict_domain_info, p, n, neg_pond=0, threshold=0.5, minimum_ocurrences=1)

source code 
Parameters:
  • dict_domain_info - A dictionary returned by the DomainAdaptor. The attribute form is the key. The value is a tuple (avg_position_in_raking, ocurrences_in_pos_files, ocurrences_in_negatives_files).
  • p - An integer between 0 and 1. The proportion of positive words included in the dictionary.
  • n - An integer between 0 and 1. The proportion of negative words included in the dictionary.
  • neg_pond - Weighting for negative words.
  • threshold
  • minimum_ocurrences

get_semantic_orientation(self, lemma, semantic_category)

source code 
Parameters:
  • semantic_category - A value in the collection {'n','a','v','r','i'}, 'n' is a noun, 'a' is an adjetive, 'v' is a verb, 'r' is an adverb and 'i' is an intensifier.
Returns:
Semantic orientation of a word
Raises:

get_lemma(self, lexical_category, token)

source code 
Parameters:
  • token - A token
  • lexical_category - The lexical category of the token
Returns:
The lemma of the token

_heuristic_lemma(self, lexical_category, word)

source code 
Parameters:
  • lexical_category - The lexical category of the word
  • word - A token
Returns:
A possible lemma of the token
Raises:
  • KeyError - If processed token isn't at lemmas dictionary