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

Class Analyzer

source code

object --+
         |
        Analyzer
Known Subclasses:

Analyzer is an abstract class which defines some methods for the SentimentAnalyzer.

Instance Methods [hide private]
 
__init__(self, parser, dictionaries, preprocessor, lexical_processor)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
analyze_from_conll(self, file_path, **kwargs) source code
 
analyze_from_plain_file(self, file_path, input_encoding='utf-8') source code
 
analyze_dir(self, dir_path, input_encoding='utf-8')
It analyzes a directory of plain texts
source code
 
analyze(self, text) source code
 
_preanalyze(self, text)
It applies pre-processing, segmentation, tokenization and PoS-taggins steps to the string to be analysed.
source code
 
_is_weka_reserved_element(self, node)
It determines if a node is a WEKA reserved symbol
source code
 
_contain_invalid_token(self, node) source code
 
_word_contain_invalid_token(self, str_word) source code
 
negation_node(self, dg, node)
Returns: A value in {neg,neg_sin} if word is 'no' or 'nunca', 'neg_sin' if word is 'sin' returns and None otherwise
source code
 
get_semantic_category(self, dg, node)
Provides information to call the correct visit function
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parser, dictionaries, preprocessor, lexical_processor)
(Constructor)

source code 

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

Parameters:
Overrides: object.__init__

analyze_from_conll(self, file_path, **kwargs)

source code 
Parameters:
  • file_path - Path to the parsed file in the CoNLL format to be analysed

analyze_from_plain_file(self, file_path, input_encoding='utf-8')

source code 
Parameters:
  • file_path - Path to the plain file to be analysed
  • input_encoding - The encoding of the input file

analyze_dir(self, dir_path, input_encoding='utf-8')

source code 

It analyzes a directory of plain texts

Parameters:
  • dir_path - Path to the directory of plain files to be analysed
  • input_encoding - The encoding of the input file

analyze(self, text)

source code 
Parameters:
  • text - The string to be analysed. Use unicode.

_preanalyze(self, text)

source code 

It applies pre-processing, segmentation, tokenization and PoS-taggins steps to the string to be analysed.

Parameters:
  • text - The string to be analysed
Returns:
A tuple. First element is a list of tagged sentences. Each tagged sentence is a list of tuples (token,InfoTag)

_is_weka_reserved_element(self, node)

source code 

It determines if a node is a WEKA reserved symbol

Parameters:
Returns:
True if node word is a WEKA reserved element, False otherwise

_contain_invalid_token(self, node)

source code 
Parameters:
  • node - A node of a SentimentDependencyGraph @return True if node word contains a reserved WEKA symbol, False otherwise

_word_contain_invalid_token(self, str_word)

source code 
Parameters:
  • str_word - A string. A word. @return True if node word contains a reserved WEKA symbol, False otherwise

negation_node(self, dg, node)

source code 
Parameters:
Returns:
A value in {neg,neg_sin} if word is 'no' or 'nunca', 'neg_sin' if word is 'sin' returns and None otherwise

get_semantic_category(self, dg, node)

source code 

Provides information to call the correct visit function

Parameters:
Returns:
The "semantic" category of word: If is a negation returns a value in {'neg','neg_sin'}, if is an intensifier returns 'i'. If is an artificial adversative node returns 'adversative' and otherwise returns lexical category of node word.