Package miopia :: Package parser :: Module SentimentDependencyGraph :: Class SentimentDependencyGraph
[hide private]
[frames] | no frames]

Class SentimentDependencyGraph

source code

                                object --+    
                                         |    
nltk.parse.dependencygraph.DependencyGraph --+
                                             |
                                            SentimentDependencyGraph

An extension of the class nltk.parse.dependencygraph.DependencyGraph to include sentiment information

Instance Methods [hide private]
 
__init__(self, tree_str=None)
Constructor
source code
 
contains_sentiment_info(self, address) source code
 
set_linguistic_info(self, node, linguistic_info) source code
 
get_linguistic_info(self, node) source code
 
get_rel(self, node)
Returns: dependency relation with head's node
source code
 
get_deps(self, node)
Returns: A list of children id's of node
source code
 
_get_adversative_id(self, node)
It obtains the adversative node identifier.
source code
 
get_tag(self, node)
Returns: The fine PoS-tag of the node
source code
 
get_ctag(self, node)
Returns: The coarse PoS-tag of the node
source code
 
get_head(self, node) source code
 
get_address(self, node)
Returns: The position in the sentence of the node.
source code
 
get_word(self, node)
Returns: The word of the node
source code
 
get_lexical_category(self, node)
Returns: The lexical category of the node
source code
 
is_leaf(self, node)
Returns: True if is a leaf node, False otherwise
source code
 
is_root_node(self, node)
Returns: True if is the root of the dependency graph, False otherwise
source code
 
is_negation_node(self, node) source code
 
is_intensifier(self, node, dictionary)
Returns: True if word is an intensifier, false otherwise
source code
 
is_emoticon(self, node) source code
 
is_artificial_node(self, node)
Returns: True if node was created artificially by src.model.parser.Parser, False otherwise
source code
 
_nodes_in_graph(self, node) source code
 
graph_to_string(self, node)
@param A node of a SentimentDependencyGraph @return A string.
source code
 
number_of_nodes(self, node) source code
 
level(self, address, level=1)
Returns: The level of a node in a dependency graph
source code
 
dg_to_json(self, node_address, dictionary) source code

Inherited from nltk.parse.dependencygraph.DependencyGraph: __repr__, __str__, add_arc, add_node, connect_graph, contains_address, contains_cycle, get_by_address, get_cycle_path, left_children, redirect_arcs, remove_by_address, right_children, to_conll, tree

Inherited from nltk.parse.dependencygraph.DependencyGraph (private): _hd, _parse, _rel, _tree, _word

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

Static Methods [hide private]

Inherited from nltk.parse.dependencygraph.DependencyGraph: load

Inherited from nltk.parse.dependencygraph.DependencyGraph (private): _normalize

Class Variables [hide private]
  ROOT_WORD = 'ROOT_WORD'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, tree_str=None)
(Constructor)

source code 

Constructor

Parameters:
  • tree_str - See nltk.parse.dependencygraph.DependencyGraph
Overrides: object.__init__

get_rel(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
Returns:
dependency relation with head's node

get_deps(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
Returns:
A list of children id's of node

_get_adversative_id(self, node)

source code 

It obtains the adversative node identifier.

Parameters:
  • tag - The tag of the artificial adversative node
Returns:
An integer

Precondition: The parameter tag must follow the regexp for adversative tags: tag:additional_information@id

get_tag(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
Returns:
The fine PoS-tag of the node

get_ctag(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
Returns:
The coarse PoS-tag of the node

get_address(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
Returns:
The position in the sentence of the node. Zero is the root node

get_word(self, node)

source code 
Returns:
The word of the node

get_lexical_category(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
Returns:
The lexical category of the node

is_leaf(self, node)

source code 
Parameters:
  • node - A node of a DependencyGraph
Returns:
True if is a leaf node, False otherwise

is_root_node(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
Returns:
True if is the root of the dependency graph, False otherwise

is_negation_node(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygrpah.DependencyGraph @return True if it's a negation node, False otherwise.

is_intensifier(self, node, dictionary)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
  • dictionary - An instance of Dictionary
Returns:
True if word is an intensifier, false otherwise

is_emoticon(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph @return True if the node is an emoticon, False otherwise

is_artificial_node(self, node)

source code 
Parameters:
  • node - A node of a nltk.parse.dependencygraph.DependencyGraph
Returns:
True if node was created artificially by src.model.parser.Parser, False otherwise

graph_to_string(self, node)

source code 

@param A node of a SentimentDependencyGraph @return A string. The raw phrase which starts in the node.

number_of_nodes(self, node)

source code 
Parameters:

level(self, address, level=1)

source code 
Parameters:
  • dg - A nltk.parse.dependencygraph.DependencyGraph instance
  • address - An integer representing the identifier of a node of dg
  • level - Initial level of the node, before recursive calls of level function
Returns:
The level of a node in a dependency graph

dg_to_json(self, node_address, dictionary)

source code 
Parameters: