public class Sentence
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Sentence.SentenceType
This class represents the different types of sentences.
|
Modifier and Type | Field and Description |
---|---|
static char[] |
mForbiddenCharacters
Specifies the characters that are filtered from the input and replaced
with "".
|
static char[] |
mSentenceDelimiters |
Constructor and Description |
---|
Sentence(java.lang.String inputText)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getParts()
Returns the input text split up at sentence separators.
|
java.lang.String |
getText()
Returns the whole input text including any parameter declarations.
|
java.lang.String |
getTextWithoutParams()
Returns the input text with parameter declarations removed from it.
|
Sentence.SentenceType |
getType()
Returns the type of the sentence.
|
java.lang.String[] |
getTypedWords()
Returns the input text without parameters split up at sentence
separators.
|
Word[] |
getWords()
Returns the
Word s of the Sentence. |
int |
indexOfWord(java.lang.String word,
int offset)
Returns the first occurrence of a word in the sentence.
|
void |
setType(Sentence.SentenceType type)
Sets the type of the sentence.
|
void |
setWords(Word[] words)
Sets the
Word s of the Sentence. |
static java.lang.String[] |
splitUpAction(java.lang.String trigger)
This function is used to split up an
Action trigger String. |
public static final char[] mForbiddenCharacters
public static final char[] mSentenceDelimiters
public Sentence(java.lang.String inputText)
inputText
- The text from the user input.public Sentence.SentenceType getType()
Sentence.SentenceType
representing the type.public void setType(Sentence.SentenceType type)
type
- A Sentence.SentenceType
to set as the type of the
sentence.public void setWords(Word[] words)
Word
s of the Sentence.words
- The Word
array to set.public java.lang.String getText()
public java.lang.String getTextWithoutParams()
public java.lang.String[] getParts()
mSentenceDelimiters
.public java.lang.String[] getTypedWords()
mSentenceDelimiters
.public int indexOfWord(java.lang.String word, int offset)
getParts()
returns. This means it can deliver parameter declarations too.word
- The word String.offset
- A number of sentence parts after which the search starts. Must
be 0 or bigger.word
in the getParts()
array
after the specified offset. Returns -1
if not found.