|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpt.tumba.geoclass.ClassNetwork
public class ClassNetwork
A probabilistic graphical model of geographical concepts, which is the basis of
the algorithm for classifying web pages according to their geographical scopes.
Essentialy, ClassNetwork
represents a place hierarchy.
As for propagating scores in the network, this class implements both a bayesian
inference procedure and a variation of the popular PageRank ranking algorithm,
as proposed by Rada Mihalcea and Paul Tarau in
"TextRank: Bringing Order into Texts".
Constructor Summary | |
---|---|
ClassNetwork()
Constructor for an uninitialized network. |
Method Summary | |
---|---|
void |
addEquivalent(java.lang.Integer id1,
java.lang.Integer id2)
Adds a "is-equivalent" relationship between two nodes in the network. |
void |
addEquivalent(Node node1,
Node node2)
Adds a "is-equivalent" relationship between two nodes in the network. |
Node |
addNode(java.lang.Integer id,
java.lang.String name,
java.lang.String type,
java.lang.Integer population)
Adds a new node to the network, constructed from the supplied parameters. |
Node |
addNode(java.lang.Integer id,
java.lang.String name,
java.lang.String type,
java.lang.Integer population,
java.lang.Double value)
Adds a new node to the network, constructed from the supplied parameters. |
Node |
addNode(Node node)
Adds a new node to the network. |
Node |
addNode(Node node,
java.lang.Double value)
Adds a new node to the network. |
void |
addPartOf(java.lang.Integer id1,
java.lang.Integer id2)
Adds a "part-of" relationship between two nodes in the network. |
void |
addPartOf(Node node1,
Node node2)
Adds a "part-of" relationship between two nodes in the network. |
void |
addRelated(java.lang.Integer id1,
java.lang.Integer id2)
Adds a "is-related" relationship between two nodes in the network. |
void |
addRelated(Node node1,
Node node2)
Adds a "is-related" relationship between two nodes in the network. |
java.util.List |
getDirectAncestors(java.lang.Integer id)
Get the direct ancestors of a given node. |
java.util.List |
getDirectAncestors(Node node)
Get the direct ancestors of a given node. |
java.util.List |
getDirectDescendants(java.lang.Integer id)
Get the direct descendants of a given node. |
java.util.List |
getDirectDescendants(Node node)
Get the direct descendants of a given node. |
java.util.List |
getDirectRelated(java.lang.Integer id)
Get the related nodes for a given node. |
java.util.List |
getDirectRelated(Node node)
Get the related nodes for a given node. |
java.util.List |
getEquivalent(Node node)
Get the equivalent nodes for a given node. |
Node |
getMaxNode()
Returns the currently highest scoring node in the network. |
java.lang.Double |
getMaxNodeScore()
Returns the score of the currently highest scoring node in the network. |
Node |
getNode(java.lang.Integer id)
Returns the node associated with a given id |
Node[] |
getNode(java.lang.String name)
Returns the node(s) associated with a given name. |
java.lang.Double |
getValue(java.lang.Integer id)
Returns the score associated with a given node of the network. |
java.lang.Double |
getValue(Node node)
Returns the score associated with a given node of the network. |
java.lang.String |
prettyPrint(Node netNode)
Prints a "human-readable" representation of a node from the network. |
void |
prettyPrint(java.io.PrintStream output)
Prints a "human-readable" representation of the network. |
void |
propagateScoresBayeasian()
Propagate scores across the network using bayesian inference. |
void |
propagateScoresTextRank()
Propagate scores across the network using a variation of the PageRank algorithm,similar to the proposal of Rada Mihalcea and Paul Tarau in "TextRank: Bringing Order into Texts". |
void |
resetScores()
Sets the scores for all the nodes in the network to zero. |
java.lang.Double |
setValue(java.lang.Integer id,
java.lang.Double value)
Updates the score associated with a given node of the network. |
java.lang.Double |
setValue(NamedEntity ne)
Updates the score associated with a given node of the network. |
java.lang.Double |
setValue(NamedEntity ne,
java.lang.Double value)
Updates the score associated with a given node of the network. |
java.lang.Double |
setValue(Node node,
java.lang.Double value)
Updates the score associated with a given node of the network. |
java.lang.Double |
setValue(java.lang.String name,
java.lang.Double value)
Updates the score associated all the nodes sharing a given name. |
java.lang.Double |
setValue(java.lang.String name,
java.lang.String type,
java.lang.Double value)
Updates the score associated all the nodes sharing a given name and/or a given type. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassNetwork()
Method Detail |
---|
public Node addNode(Node node)
node
- The node to Add.
public Node addNode(Node node, java.lang.Double value)
node
- The node to add.value
- The score to associate with the node.
public Node addNode(java.lang.Integer id, java.lang.String name, java.lang.String type, java.lang.Integer population)
id
- The ID for this geographical concept at the knowledge base (GKB).name
- The Name associated with this geographical concept.type
- The type of this geographical concept.population
- Number of habitants associated with this region.
public Node addNode(java.lang.Integer id, java.lang.String name, java.lang.String type, java.lang.Integer population, java.lang.Double value)
id
- The ID for this geographical concept at the knowledge base (GKB).name
- The Name associated with this geographical concept.type
- The type of this geographical concept.population
- Number of habitants associated with this region.value
- The score to associate with the node.
public void addPartOf(Node node1, Node node2)
node1
- A Node.node2
- Another node.public void addPartOf(java.lang.Integer id1, java.lang.Integer id2)
node1
- A Node ID.node2
- Another node ID.public void addRelated(Node node1, Node node2)
node1
- A Node.node2
- Another node.public void addRelated(java.lang.Integer id1, java.lang.Integer id2)
node1
- A Node ID.node2
- Another node ID.public void addEquivalent(Node node1, Node node2)
node1
- A Node.node2
- Another node.public void addEquivalent(java.lang.Integer id1, java.lang.Integer id2)
id1
- A Node ID.id2
- Another node ID.public Node getNode(java.lang.Integer id)
id
- The id of the Node to return.
public Node[] getNode(java.lang.String name)
name
- The name of the Node(s) to return.
public java.lang.Double getValue(java.lang.Integer id)
id
- A node ID.
public java.lang.Double getValue(Node node)
node
- A node.
public java.lang.Double setValue(NamedEntity ne)
ne
- The Named Entity corresponding to the node.
public java.lang.Double setValue(NamedEntity ne, java.lang.Double value)
ne
- The Named Entity corresponding to the node.value
- The score to associate with the node.
public java.lang.Double setValue(Node node, java.lang.Double value)
node
- A node.value
- The score to associate with the node.
public java.lang.Double setValue(java.lang.Integer id, java.lang.Double value)
id
- A node ID.value
- The score to associate with the node.
public java.lang.Double setValue(java.lang.String name, java.lang.Double value)
name
- A node name.value
- The score to associate with the node.
public java.lang.Double setValue(java.lang.String name, java.lang.String type, java.lang.Double value)
name
- A node name (or null if names should be ignored).type
- A node type (or null if types should be ignored).value
- The score to associate with the node.
public Node getMaxNode()
public java.lang.Double getMaxNodeScore()
public void propagateScoresTextRank()
public void propagateScoresBayeasian()
public java.util.List getDirectDescendants(Node node)
node
- A node
public java.util.List getDirectDescendants(java.lang.Integer id)
id
- A node ID
public java.util.List getDirectAncestors(Node node)
node
- A node
public java.util.List getDirectAncestors(java.lang.Integer id)
node
- A node ID
public java.util.List getDirectRelated(Node node)
node
- A node
public java.util.List getDirectRelated(java.lang.Integer id)
node
- A node ID
public java.util.List getEquivalent(Node node)
node
- A node
public void resetScores()
public java.lang.String prettyPrint(Node netNode)
netNode
- The node in the network.
public void prettyPrint(java.io.PrintStream output)
output
- A PrintWriter to where we should print the "human-readable" representation of the network.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |