public final class ReaderWorld extends TextWorld
Modifier and Type | Class and Description |
---|---|
static class |
ReaderWorld.ParseStyle
List of parsing style.
|
TextWorld.TextItem
tokenDictionary
Modifier and Type | Method and Description |
---|---|
void |
addTokenVectorPair(java.lang.String token,
double[] vector)
Add an entry to the token-vector dictionary.
|
static ReaderWorld |
createReaderWorld()
Factory method for Reader world.
|
double[] |
getCurrentVector()
Returns the double array associated with the currently selected token
(character or word).
|
int |
getMatchingScalar(java.lang.String token)
Returns 1 if the current item is this character, or 0 otherwise.
|
double[] |
getMatchingVector(java.lang.String token)
Return the vector associated with the currently parsed token, or a
default zero vector.
|
ComboBoxWrapper |
getParseStyle()
Returns the current parse style inside a comboboxwrapper.
|
java.lang.String |
getRegularExpression() |
ReaderWorld.ParseStyle |
getTheParseStyle()
Get the current parse style.
|
java.util.LinkedHashMap<java.lang.String,double[]> |
getTokenToVectorDict() |
(package private) static com.thoughtworks.xstream.XStream |
getXStream()
Returns a properly initialized xstream object.
|
void |
loadTokenToVectorDict(java.lang.String[][] tableData)
Loads a vector to token dictionary.
|
java.lang.String |
previewNextToken()
Utility method to "preview" the next token after the current one.
|
void |
setParseStyle(ComboBoxWrapper parseStyle)
Set the current parse style.
|
void |
setParseStyle(ReaderWorld.ParseStyle parseStyle) |
void |
setRegularExpression(java.lang.String regularExpression) |
void |
update()
Advance the position in the text, and update the current item.
|
(package private) void |
updateMatcher()
Reset the parser and specify the region focused on by it, to go from the
current cursor position to the end of the text.
|
addListener, addText, addWordToTokenDictionary, fireCurrentItemChanged, fireDictionaryChangedEvent, firePositionChangedEvent, firePrefsChangedEvent, fireTextChangedEvent, getCurrentItem, getHighlightColor, getLastPosition, getPosition, getText, getTokenDictionary, loadTokenDictionary, previewNextChar, readResolve, removeListener, setCurrentItem, setHighlightColor, setPosition, setPosition, setText, setText
public static ReaderWorld createReaderWorld()
public int getMatchingScalar(java.lang.String token)
token
- the letter to search forpublic double[] getMatchingVector(java.lang.String token)
token
- the token to associate with a vectorpublic double[] getCurrentVector()
public void loadTokenToVectorDict(java.lang.String[][] tableData)
tableData
- the dictionary to add.public void addTokenVectorPair(java.lang.String token, double[] vector)
token
- the String to addvector
- the vectorpublic java.util.LinkedHashMap<java.lang.String,double[]> getTokenToVectorDict()
public void update()
void updateMatcher()
public java.lang.String previewNextToken()
public ComboBoxWrapper getParseStyle()
public void setParseStyle(ComboBoxWrapper parseStyle)
parseStyle
- the current style.public ReaderWorld.ParseStyle getTheParseStyle()
public void setParseStyle(ReaderWorld.ParseStyle parseStyle)
parseStyle
- the parseStyle to setstatic com.thoughtworks.xstream.XStream getXStream()
public java.lang.String getRegularExpression()
public void setRegularExpression(java.lang.String regularExpression)
regularExpression
- the regularExpression to set