public class Word
extends java.lang.Object
Language
interface.Modifier and Type | Class and Description |
---|---|
static class |
Word.WordType
Contains the standard word types.
|
Constructor and Description |
---|
Word(java.lang.String typedForm,
java.lang.String normalForm,
int type,
java.lang.String[] synonyms)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Word word,
boolean caseSensitive)
Checks whether the word equals another in any way.
|
boolean |
equalsExact(Word word)
Checks whether the typed form of the word equals the typed form of
another.
|
boolean |
equalsNormalForm(Word word,
boolean caseSensitive)
Checks whether the normal form of the word equals the normal form of
another.
|
boolean |
equalsSynonym(Word word,
boolean caseSensitive)
Checks whether the word is the synonym of another or the other way
around.
|
java.lang.String |
getNormalForm()
Returns the normal/base form of a word.
|
java.lang.String[] |
getSynonyms()
Returns the synonyms of the word.
|
int |
getType()
Returns the type of the word.
|
java.lang.String |
getTypedForm()
Returns the form the word occurred in the input.
|
void |
setNormalForm(java.lang.String normalForm)
Sets the normal/base form if a word.
|
void |
setSynonyms(java.lang.String[] synonyms)
Sets the synonyms of the word.
|
void |
setType(int type)
Sets the type of the word.
|
void |
setTypedForm(java.lang.String typedForm)
Sets the form the word occurred in the input.
|
public Word(java.lang.String typedForm, java.lang.String normalForm, int type, java.lang.String[] synonyms)
typedForm
- The form the word occurs in the input.normalForm
- The normal/base form of a word.type
- The type.synonyms
- An array of synonyms. If there are no synonyms, pass an empty
array. Must not be null
.public java.lang.String getTypedForm()
public void setTypedForm(java.lang.String typedForm)
typedForm
- The typed form of the word.public java.lang.String getNormalForm()
public void setNormalForm(java.lang.String normalForm)
normalForm
- The normal form.public int getType()
int
representing the type of the word.public void setType(int type)
type
- An int
representing the type of the word. Note: This
is language-dependent, so the word types defined in the
respective Language
interface should be used.public java.lang.String[] getSynonyms()
public void setSynonyms(java.lang.String[] synonyms)
synonyms
- The synonyms array to set. Must not be null
.public boolean equalsSynonym(Word word, boolean caseSensitive)
word
- The word to check with.caseSensitive
- Whether the comparison should be case sensitive.true
when they are synonyms, false
when not.public boolean equalsNormalForm(Word word, boolean caseSensitive)
word
- The word to check with.caseSensitive
- Whether the comparison should be case sensitive.true
when they have the same normal form, false
when not.public boolean equalsExact(Word word)
word
- The word to check with.true
when they have the same typed form, false
when not.public boolean equals(Word word, boolean caseSensitive)
word
- The word to check with.caseSensitive
- Whether the comparison should be case sensitive.true
when they have the same typed form, normal form or
share synonyms. false
when not.