WORDNET GRAPH ###################################################################################. More...
Public Member Functions | |
def | __init__ |
def | click |
def | draw |
def | expand |
def | get_relations |
def | get_senses |
def | is_clickable |
def | is_expandable |
def | load |
Public Attributes | |
max | |
senses | |
styles |
WORDNET GRAPH ###################################################################################.
Browse WordNet in a graph. The wordnetgraph class is based on the standard graph class. I've added some functionality to fetch data from WordNet and browse through it. When you click on a node, the wordnetgraph.click() method is fired. This will check if the clicked node is a noun in WordNet, and if so, reload the graph's nodes and connections with that noun at the root. The main methods, get_senses() and get_relations(), are called when the graph reloads. They retrieve data from WordNet and format it as nodes. The expand() method is called when you click on "has-specific" or "has-parts". A helper class, senses, draws the interactive word sense selection buttons.
Definition at line 19 of file graph_example4.py.
def graph_example4.wordnetgraph.__init__ | ( | self, | |
iterations = 2000 , |
|||
distance = 1.3 |
|||
) |
Definition at line 38 of file graph_example4.py.
def graph_example4.wordnetgraph.click | ( | self, | |
node | |||
) |
If the node is indeed clickable, load it.
Definition at line 167 of file graph_example4.py.
def graph_example4.wordnetgraph.draw | ( | self, | |
args, | |||
kwargs | |||
) |
Additional drawing for sense selection buttons.
Definition at line 213 of file graph_example4.py.
def graph_example4.wordnetgraph.expand | ( | self, | |
relation, | |||
previous = None |
|||
) |
Zoom in to the hyponym or holonym branch.
Definition at line 138 of file graph_example4.py.
def graph_example4.wordnetgraph.get_relations | ( | self, | |
word, | |||
previous = None |
|||
) |
The graph displays semantic relations for a noun, e.g. light -> has-specific -> candlelight.
Definition at line 95 of file graph_example4.py.
def graph_example4.wordnetgraph.get_senses | ( | self, | |
word, | |||
top = 6 |
|||
) |
The graph displays the different senses of a noun, e.g. light -> lighter, luminosity, sparkle, ...
Definition at line 73 of file graph_example4.py.
def graph_example4.wordnetgraph.is_clickable | ( | self, | |
node | |||
) |
Every node that is a noun is clickable (except the root).
Definition at line 62 of file graph_example4.py.
def graph_example4.wordnetgraph.is_expandable | ( | self, | |
id | |||
) |
Some of the branches are expandable: if you click on has-parts or has-specific, a detailed view will load.
Definition at line 51 of file graph_example4.py.
def graph_example4.wordnetgraph.load | ( | self, | |
word, | |||
previous = None |
|||
) |
Definition at line 178 of file graph_example4.py.
Definition at line 38 of file graph_example4.py.
Definition at line 38 of file graph_example4.py.
Definition at line 38 of file graph_example4.py.