|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrita.support.TextNode
public class TextNode
A node in a graph containing text and some # of child TextNodes
| Field Summary | |
|---|---|
static int |
totalNodes
the # of non-root nodes |
static int |
totalTokens
the # of tokens processed |
| Method Summary | |
|---|---|
TextNode |
addChild(char c,
int initialCount)
|
TextNode |
addChild(java.lang.String newToken)
If the newToken does not exist as a child, creates a new
child node with a frequency of 1 (e.g., else increments the existing
child node's frequency by 1. |
TextNode |
addChild(java.lang.String newToken,
int initialCount)
If the newToken does not exist as a child, creates a new
child node with initialCount as its frequency (e.g.,
for smoothing), else increments the existing child nodes frequency
by 1 |
java.lang.String |
asTree(boolean sort)
|
java.util.Iterator |
childIterator()
|
int |
compareTo(java.lang.Object o)
|
static TextNode |
createRoot(boolean ignoreCase)
|
java.util.Map |
getChildMap()
|
java.util.Collection |
getChildNodes()
|
java.util.List |
getChildNodes(java.lang.String regex)
Returns a List of all children matching the supplied regular expression. |
int |
getCount()
|
float |
getProbability()
Returns a probability value between 0 - 1 |
float |
getRawValue()
To satisfy the RiProbable interface; simply returns the count here |
java.lang.String |
getToken()
|
boolean |
hasChildren()
|
boolean |
hasChildren(java.lang.String regex)
Return true if the node has at least one child matching the given regular expression (if one is supplied). |
int |
increment()
|
boolean |
isIgnoringCase()
|
boolean |
isLeaf()
|
boolean |
isRoot()
|
boolean |
isSentenceStart()
|
TextNode |
lookup(char charToLookup)
Does a lookup on the children of this node and returns any nodes that match charToLookup, else returns null. |
TextNode |
lookup(RiTextNode tokenToLookup)
Does a lookup on the children of this node and returns any nodes that match tokenToLookup, else returns null. |
TextNode |
lookup(java.lang.String tokenToLookup)
Does a lookup on the children of this node and returns any nodes that match tokenToLookup, else returns null. |
static void |
main(java.lang.String[] args)
|
int |
numChildren()
Returns number of children of this node |
void |
pathFromRoot(java.util.Stack result)
|
TextNode |
selectChild()
|
TextNode |
selectChild(boolean probabalisticSelect)
|
TextNode |
selectChild(java.lang.String regex,
boolean probabalisticSelect)
|
void |
setCount(int initialCount)
|
void |
setIgnoreCase(boolean b)
|
void |
setIsSentenceStart(boolean isSentenceStart)
|
java.lang.String |
toString()
|
int |
uniqueCount()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int totalTokens
public static int totalNodes
| Method Detail |
|---|
public static TextNode createRoot(boolean ignoreCase)
public TextNode addChild(java.lang.String newToken)
RiTextNodenewToken does not exist as a child, creates a new
child node with a frequency of 1 (e.g., else increments the existing
child node's frequency by 1.
addChild in interface RiTextNode
public TextNode addChild(char c,
int initialCount)
addChild in interface RiTextNode
public TextNode addChild(java.lang.String newToken,
int initialCount)
RiTextNodenewToken does not exist as a child, creates a new
child node with initialCount as its frequency (e.g.,
for smoothing), else increments the existing child nodes frequency
by 1
addChild in interface RiTextNodepublic java.lang.String getToken()
getToken in interface RiTextNodepublic int getCount()
getCount in interface RiTextNodepublic int increment()
increment in interface RiTextNodepublic java.lang.String toString()
toString in interface RiTextNodetoString in class java.lang.Objectpublic boolean isRoot()
isRoot in interface RiTextNodepublic void pathFromRoot(java.util.Stack result)
pathFromRoot in interface RiTextNodepublic int uniqueCount()
uniqueCount in interface RiTextNodepublic float getProbability()
RiProbable
getProbability in interface RiProbablegetProbability in interface RiTextNodepublic java.util.Iterator childIterator()
childIterator in interface RiTextNodepublic int numChildren()
RiTextNode
numChildren in interface RiTextNodepublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.ComparablecompareTo in interface RiTextNodepublic TextNode lookup(java.lang.String tokenToLookup)
RiTextNodetokenToLookup, else returns null.
lookup in interface RiTextNodepublic TextNode lookup(RiTextNode tokenToLookup)
RiTextNodetokenToLookup, else returns null.
lookup in interface RiTextNodepublic TextNode lookup(char charToLookup)
RiTextNodecharToLookup, else returns null.
lookup in interface RiTextNodepublic java.util.Collection getChildNodes()
getChildNodes in interface RiTextNodepublic java.lang.String asTree(boolean sort)
asTree in interface RiTextNodepublic boolean isLeaf()
isLeaf in interface RiTextNodepublic void setIgnoreCase(boolean b)
setIgnoreCase in interface RiTextNodepublic boolean isIgnoringCase()
isIgnoringCase in interface RiTextNodepublic TextNode selectChild()
selectChild in interface RiTextNodepublic TextNode selectChild(boolean probabalisticSelect)
selectChild in interface RiTextNode
public TextNode selectChild(java.lang.String regex,
boolean probabalisticSelect)
selectChild in interface RiTextNodepublic java.util.List getChildNodes(java.lang.String regex)
getChildNodes in interface RiTextNoderegex - public List getChildren(String regex)
{
Matcher m = null;
List tmp = new LinkedList();
Pattern p = Pattern.compile(regex);
for (Iterator i = childIterator(); i.hasNext();)
{
TextNode tn = (TextNode) i.next();
m = p.matcher(tn.getWord());
if (m.matches())
tmp.add(tn.getWord());
}
return tmp;
}
public boolean hasChildren(java.lang.String regex)
RiTextNode
hasChildren in interface RiTextNodepublic boolean hasChildren()
hasChildren in interface RiTextNodepublic java.util.Map getChildMap()
getChildMap in interface RiTextNodepublic boolean isSentenceStart()
isSentenceStart in interface RiTextNodepublic void setIsSentenceStart(boolean isSentenceStart)
setIsSentenceStart in interface RiTextNodepublic void setCount(int initialCount)
setCount in interface RiTextNodepublic float getRawValue()
getRawValue in interface RiProbablepublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||