|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.whatswrong.Token
public class Token
A Token represents a word in an utterance. It consists of an index and a set of properties with name and value.
Constructor Summary | |
---|---|
Token(int index)
Creates a new token with the given index. |
Method Summary | |
---|---|
void |
addProperty(int index,
java.lang.String property)
Add the property with name "Property [index]" and the given value. |
void |
addProperty(java.lang.String value)
Adds a property with the given value. |
Token |
addProperty(java.lang.String name,
java.lang.String value)
Add a property with the given name and value. |
Token |
addProperty(TokenProperty property,
java.lang.String value)
Add a property with given value. |
int |
compareTo(Token o)
Compares the indices of both tokens. |
boolean |
equals(java.lang.Object o)
Checks whether the two tokens have the same index. |
int |
getIndex()
Returns the index of the token. |
java.lang.String |
getProperty(TokenProperty property)
Get the value of the given property. |
java.util.Collection<TokenProperty> |
getPropertyTypes()
Return all token properties (the property names). |
java.util.Collection<java.lang.String> |
getPropertyValues()
Returns a collection of all property values. |
java.util.List<TokenProperty> |
getSortedProperties()
Sorts the properties by property level and name. |
int |
hashCode()
Returns the index of the token. |
void |
merge(Token token)
Inserts all properties and values of the other token into this token. |
boolean |
propertiesContain(java.util.Collection<java.lang.String> substrings,
boolean wholeWord)
Check whether any of the property values of this token contains any of the strings in the given set of strings. |
boolean |
propertiesContain(java.lang.String substring)
Check whether any of the property values contains the given string. |
void |
removeProperty(int index)
Remove the property value with given index. |
void |
removeProperty(java.lang.String name)
Remove the property value with the given name. |
java.lang.String |
toString()
Returns a string representation of this token containing token index and properties. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Token(int index)
index
- the index of the token.Method Detail |
---|
public int getIndex()
public java.util.Collection<TokenProperty> getPropertyTypes()
getProperty(TokenProperty)
.
public java.lang.String getProperty(TokenProperty property)
property
- the property to get the value for.
public void removeProperty(int index)
index
- the index of the property to remove.public void removeProperty(java.lang.String name)
name
- the name of the property to remove.public Token addProperty(java.lang.String name, java.lang.String value)
name
- the name of the property.value
- the value of the property.
public void addProperty(int index, java.lang.String property)
index
- the index of the propertyproperty
- the value of the property.public Token addProperty(TokenProperty property, java.lang.String value)
property
- the property to addvalue
- the value of the property
public void addProperty(java.lang.String value)
value
- the value of the property.public java.util.List<TokenProperty> getSortedProperties()
public java.util.Collection<java.lang.String> getPropertyValues()
public boolean propertiesContain(java.lang.String substring)
substring
- the string to check whether it is contained in any property value of this token.
substring
is a substring of the
corresponding property value.public boolean propertiesContain(java.util.Collection<java.lang.String> substrings, boolean wholeWord)
substrings
- set of strings to checkwholeWord
- should we check for complete words of is it enough for the given strings to be substrings of
the token value.
substrings
(wholeword=true) or b) if there is a property value that contains one of the strings in
substrings
(wholeword=false).public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the other token.
index==((Token)o).index
public int hashCode()
hashCode
in class java.lang.Object
public void merge(Token token)
token
- the token to merge with.public int compareTo(Token o)
compareTo
in interface java.lang.Comparable<Token>
o
- the other token.
index - o.getIndex()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |