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

Class PsychometricDictionary

source code

This class is responsible of handling psychometric dictionaries which follow the LIWC format

Instance Methods [hide private]
 
_generate_tree(self)
Create a binary tree for an efficient search of the regexp included in those kind of dictionaries
source code
 
get_psychometric_categories(self, str_word)
Returns: A list with the psychometric categories of str_word.
source code
 
generateDictionary(self, categories, words, ascii_only=True)
It generates the psychometric dictionary
source code
 
readFromFile(self, filename=None, encoding='utf-8')
Reads a psychometric dictionary from a LWIC-formatted file
source code
Class Variables [hide private]
  _categories = []
  _words = {}
  _root = None
  _regexp_keys_tree = None
Method Details [hide private]

get_psychometric_categories(self, str_word)

source code 
Parameters:
  • str_word - A string. A word.
Returns:
A list with the psychometric categories of str_word.

generateDictionary(self, categories, words, ascii_only=True)

source code 

It generates the psychometric dictionary

Parameters:
  • categories - dictionary of categories, Dictionary<id_category,category_name>
  • words - dictionary of words, Dictionary<word, List<id_category>>. Wildcard "*" is supported
  • ascci_only - if true, all unicode characters will be converted to the closest ascii representation

readFromFile(self, filename=None, encoding='utf-8')

source code 

Reads a psychometric dictionary from a LWIC-formatted file

Parameters:
  • filename - None to use the path included at the configuration file.
  • encoding - Encoding of the dictionary