|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mit.jmwe.data.Token
public class Token
Default implementation of the IToken
interface.
Constructor Summary | |
---|---|
Token(String text,
String tag)
Constructs a new token object with the specified text and tag, with no stems yet assigned. |
|
Token(String text,
String tag,
String... stems)
Constructs a new token object with the specified text, tag, and stems. |
Method Summary | |
---|---|
static List<String> |
checkStems(String[] stems)
Checks the specified array of strings to ensure each one is non- null , and, once trimmed, is not empty and does not contain
whitespace. |
static String |
checkString(String text)
Checks the specified string to see that, once trimmed, it is not empty and does not contain whitespace. |
String |
getForm()
Returns the object's surface form text, exactly as it appears in its original context, with capitalization intact. |
List<String> |
getStems()
Returns an unmodifiable list of stems, all in lowercase. |
String |
getTag()
Returns the part of speech tag for this token, or null if
the token is not tagged. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Token(String text, String tag)
text
- the surface form of the token as it appears in the sentence,
capitalization intacttag
- the tag of the token, if assigned, otherwise null
NullPointerException
- if the text is null
NullPointerException
- if the text is null
IllegalArgumentException
- if the trimmed text is empty or contains whitespacepublic Token(String text, String tag, String... stems)
text
- the surface form of the token as it appears in the sentence,
capitalization intacttag
- the tag of the token, if assigned, otherwise null
stems
- the array of stems, possibly empty or null
, but
not containing null
. If null
, this
means that no stemming has yet been attempted. If empty, this
means the token is not stemmable.
NullPointerException
- if the text is null
, or any of the stems are
null
IllegalArgumentException
- if the trimmed text is empty or contains whitespaceMethod Detail |
---|
public String getForm()
IHasForm
null
.
getForm
in interface IHasForm
null
.public String getTag()
IToken
null
if
the token is not tagged. If the part of speech is null
, no
part of speech has yet been assigned.
getTag
in interface IToken
null
if
the token is not tagged.public List<String> getStems()
IToken
null
, this means no
stemming has yet been attempted.
getStems
in interface IToken
null
, possibly empty list of lowercase
stemspublic String toString()
toString
in class Object
public static String checkString(String text)
text
- the text to be checked
NullPointerException
- if the specified String is null
IllegalArgumentException
- if, after being trimmed, the specified String is empty or
contains whitespacepublic static List<String> checkStems(String[] stems)
null
, and, once trimmed, is not empty and does not contain
whitespace. If all strings check out, an unmodifiable list of the
trimmed, lowercase strings is returned. Otherwise, the method throws an
exception.
stems
- the list of stems to check; may be null
or empty,
but may not contain null
NullPointerException
- if the any string in the array is null
IllegalArgumentException
- if, after being trimmed, any string in the array is empty or
contains whitespace
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |