emolib.classifier.machinelearning
Class ARNReduced.Graph

java.lang.Object
  extended by emolib.classifier.machinelearning.ARNReduced.Graph
Enclosing class:
ARNReduced

public class ARNReduced.Graph
extends java.lang.Object

Generic graph inner class. As a general rule, the graph contains the minimum amount of valuable information, i.e., the term frequencies. For more enhanced IR measures the ARN should be able to manage with these rates.


Constructor Summary
ARNReduced.Graph()
          Graph constructor.
 
Method Summary
 void addLink(ARNReduced.GraphElement link)
          Method to add a link with its frequential information.
 void addLink(java.lang.String lTerm, java.lang.String rTerm)
          Method to add a link.
 void addNode(ARNReduced.GraphElement term)
          Method to add a node with its frequential information.
 void addNode(java.lang.String term)
          Method to add a node.
 ARNReduced.Graph cloneGraph()
          Function to clone this graph.
 boolean containsElement(ARNReduced.GraphElement elem)
          Function to determine if it contains an element.
 boolean containsLink(java.lang.String linkLeftTerm, java.lang.String linkRightTerm)
          Function to check if the graph contains a specific link.
 boolean containsNode(java.lang.String nodeTerm)
          Function to check if the graph contains a specific node.
 void dumpContent()
          Dump the content of this graph for debugging purposes.
 int[] exportVectorTF()
          Function to export this graph as a vector of term frequencies.
 float[] exportWeighedVector()
          Function to export this graph as a vector of weighed measures.
 Jama.Matrix exportWeightedMatrix()
          Function to export this graph into a weighted matrix.
 java.util.ArrayList<java.lang.String> getArrayOfTerms()
          Function to retrieve a list of terms from this graph.
 java.lang.String getCategoryName()
          Function to get the category name of this graph.
 ARNReduced.GraphElement getElement(int num)
          Function to retrive the specified element of this graph.
 int getElementTermFrequency(ARNReduced.GraphElement elem)
          Function to retrieve the TF of the given graph element, whatsoever it is (node or term).
 int getLinkTermFrequency(java.lang.String linkLeftTerm, java.lang.String linkRightTerm)
          Function to retrieve the term frequency of a given link.
 java.util.ArrayList<java.lang.String> getListOfNodes()
          Function to retrieve the number of nodes (ie words) of this graph.
 int getNodeTermFrequency(java.lang.String nodeTerm)
          Function to retrieve the term frequency of a given node.
 int getNumberOfElements()
          Function to retrieve the number of elements of this graph.
 int getTotalSumTF()
          Function to retrieve the total sum of term frequencies in this structure.
 void pruneUtility(int numSelected)
          Prunes the graph by ordering terms wrt their utility and removing the least useful.
 void removeElement(int index)
          Removes a single element.
 void resetTermFrequencies()
          Method to reset the term frequencies of this graph.
 void setCategoryName(java.lang.String name)
          Method to add a category name to this graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ARNReduced.Graph

public ARNReduced.Graph()
Graph constructor.

Method Detail

getNumberOfElements

public int getNumberOfElements()
Function to retrieve the number of elements of this graph.

Returns:
The number of elements.

getListOfNodes

public java.util.ArrayList<java.lang.String> getListOfNodes()
Function to retrieve the number of nodes (ie words) of this graph.

Returns:
The number of nodes.

getArrayOfTerms

public java.util.ArrayList<java.lang.String> getArrayOfTerms()
Function to retrieve a list of terms from this graph.

Returns:
The list of terms.

setCategoryName

public void setCategoryName(java.lang.String name)
Method to add a category name to this graph.

Parameters:
name - The name.

getCategoryName

public java.lang.String getCategoryName()
Function to get the category name of this graph.

Returns:
The category name of this graph.

getTotalSumTF

public int getTotalSumTF()
Function to retrieve the total sum of term frequencies in this structure.

Returns:
The total sum of term frequencies.

dumpContent

public void dumpContent()
Dump the content of this graph for debugging purposes.


addNode

public void addNode(java.lang.String term)
Method to add a node. If the node to add is already available in the graph structure, its term frequency is increased a unit.

Parameters:
term - The term of the node to add.

addNode

public void addNode(ARNReduced.GraphElement term)
Method to add a node with its frequential information.

Parameters:
term - The node to add.

containsNode

public boolean containsNode(java.lang.String nodeTerm)
Function to check if the graph contains a specific node.

Parameters:
nodeTerm - The node term.
Returns:
True if the graph contains a specific node.

getNodeTermFrequency

public int getNodeTermFrequency(java.lang.String nodeTerm)
Function to retrieve the term frequency of a given node.

Parameters:
nodeTerm - The node term.
Returns:
The TF of this node.

addLink

public void addLink(java.lang.String lTerm,
                    java.lang.String rTerm)
Method to add a link. If the link to add is already available in the graph structure, its term frequency is increased a unit.

Parameters:
lTerm - The left term of the link to add.
rTerm - The right term of the link to add.

addLink

public void addLink(ARNReduced.GraphElement link)
Method to add a link with its frequential information.

Parameters:
link - The link to add.

containsLink

public boolean containsLink(java.lang.String linkLeftTerm,
                            java.lang.String linkRightTerm)
Function to check if the graph contains a specific link.

Parameters:
linkLeftTerm - The link left term.
linkRightTerm - The link right term.
Returns:
True if the graph contains a specific link.

getLinkTermFrequency

public int getLinkTermFrequency(java.lang.String linkLeftTerm,
                                java.lang.String linkRightTerm)
Function to retrieve the term frequency of a given link.

Parameters:
linkLeftTerm - The link left term.
linkRightTerm - The link right term.
Returns:
The TF of this link.

getElement

public ARNReduced.GraphElement getElement(int num)
Function to retrive the specified element of this graph.

Parameters:
num - Element number.
Returns:
The specified element.

containsElement

public boolean containsElement(ARNReduced.GraphElement elem)
Function to determine if it contains an element.

Parameters:
elem - The element under test.
Returns:
TRUE if it is contained.

getElementTermFrequency

public int getElementTermFrequency(ARNReduced.GraphElement elem)
Function to retrieve the TF of the given graph element, whatsoever it is (node or term).

Parameters:
elem - The input graph element.
Returns:
The TF of the given graph element.

exportVectorTF

public int[] exportVectorTF()
Function to export this graph as a vector of term frequencies.

Returns:
The vector of TFs.

exportWeighedVector

public float[] exportWeighedVector()
Function to export this graph as a vector of weighed measures.

Returns:
The vector of weighed measures.

exportWeightedMatrix

public Jama.Matrix exportWeightedMatrix()
Function to export this graph into a weighted matrix.

Returns:
The weighted matrix.

cloneGraph

public ARNReduced.Graph cloneGraph()
Function to clone this graph.

Returns:
A clone of this graph.

resetTermFrequencies

public void resetTermFrequencies()
Method to reset the term frequencies of this graph.


pruneUtility

public void pruneUtility(int numSelected)
Prunes the graph by ordering terms wrt their utility and removing the least useful.

Parameters:
numSelected - The number of useful terms desired.

removeElement

public void removeElement(int index)
Removes a single element.

Parameters:
index - The index of the element to remove.