public class ClassifierNew extends Object
Token,
TokenArrayList| Constructor and Description |
|---|
ClassifierNew()
Default constructor.
|
ClassifierNew(Dictionary d)
Creates a new classifier that recognizes the tokens specified in the
given dictionary.
|
ClassifierNew(Dictionary d,
boolean useDefaults)
Creates a new classifier that recognizes the tokens specified in the
given dictionary.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addKeyword(String k,
int i)
Adds a new keyword to the classifier's dictionary.
|
boolean |
addSeparator(String c,
int i)
Adds a new separator to the classifier.
|
ArrayList<Token> |
classify(String s,
boolean returnSeps)
The classify function breaks down the specified string into tokens and
passes back an array of classified tokens.
|
boolean |
isKeyWord(String k)
tries to find the keyword in our dictionary.
|
public ClassifierNew()
public ClassifierNew(Dictionary d)
d - The dictionary that contains keyword tokens.public ClassifierNew(Dictionary d, boolean useDefaults)
d - The dictionary that contains keyword tokens.useDefaults - A flag that indicates whether or not we should use the
default delimiter characters ' ', \t \r \n \f when tokenizing a string. If
this flag is set to false, you should add your own seperator characters using
the addSeperator() method.public boolean addKeyword(String k, int i)
The text should be 2 or more characters in length. If you want to recognize a single character as a token, you should add it using the addSeparator() method.
k - The text to be recognized as a keyword.i - Its unique numeric identifier.public boolean isKeyWord(String k)
k - the string to find.public boolean addSeparator(String c, int i)
c - A string containing a single character to be recognized as a separator.i - Its unique numeric identifier.Copyright © 2023. All rights reserved.