Package opennlp.tools.ngram
Klasse NGramCharModel
java.lang.Object
opennlp.tools.ngram.NGramCharModel
- Alle implementierten Schnittstellen:
Iterable<CharSequence>
The
NGramCharModel
can be used to create character ngrams.- Siehe auch:
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
add
(CharSequence ngram) Adds anngram
.void
add
(CharSequence chars, int minLength, int maxLength) Adds aCharSequence
that will be ngrammed into chars.boolean
contains
(CharSequence ngram) Checks if the givenngram
is contained in aNGramCharModel
.void
cutoff
(int cutoffUnder, int cutoffOver) Deletes all ngram which do appear less than thecutoffUnder
value and more often than thecutoffOver
value.boolean
int
getCount
(CharSequence ngram) Retrieves the count of the givenngram
.int
hashCode()
iterator()
int
Retrieves the total count of all Ngrams.void
remove
(CharSequence ngram) Removes the specifiedngram
is from aNGramCharModel
.void
setCount
(CharSequence ngram, int count) Sets the count of an existingngram
.int
size()
Retrieves the number ofentries
in aNGramCharModel
.toString()
Von Schnittstelle geerbte Methoden java.lang.Iterable
forEach, spliterator
-
Konstruktordetails
-
NGramCharModel
public NGramCharModel()Initializes an empty instance.
-
-
Methodendetails
-
getCount
Retrieves the count of the givenngram
.- Parameter:
ngram
- Thengram
to get the count for.- Gibt zurück:
- Count of the
ngram
or0
if it is not contained at all.
-
setCount
Sets the count of an existingngram
.- Parameter:
ngram
- Thengram
to get the count for.count
- The count of thengram
to set.
-
add
Adds anngram
. If it already exists the count increase by one.- Parameter:
ngram
- TheCharSequence
to be added.
-
add
Adds aCharSequence
that will be ngrammed into chars.- Parameter:
chars
- TheCharSequence
to be ngrammed.minLength
- The minimal length for'n'
to populate ngrams with.maxLength
- The maximum length for'n'
to populate ngrams with.
-
remove
Removes the specifiedngram
is from aNGramCharModel
.- Parameter:
ngram
- Thengram
to remove. Ifnull
, the model keeps its state.
-
contains
Checks if the givenngram
is contained in aNGramCharModel
.- Parameter:
ngram
- Thengram
to check. Ifnull
, the model keeps its state.- Gibt zurück:
true
if the ngram is contained,false
otherwise.
-
size
public int size()Retrieves the number ofentries
in aNGramCharModel
.- Gibt zurück:
- Number of different grams or
0
if the model is empty.
-
iterator
- Angegeben von:
iterator
in SchnittstelleIterable<CharSequence>
- Gibt zurück:
- iterator over all ngrams
-
numberOfGrams
public int numberOfGrams()Retrieves the total count of all Ngrams.- Gibt zurück:
- total count of all ngrams
-
cutoff
public void cutoff(int cutoffUnder, int cutoffOver) Deletes all ngram which do appear less than thecutoffUnder
value and more often than thecutoffOver
value.- Parameter:
cutoffUnder
- The lower boundary to use for deletions. Must be greater than0
.cutoffOver
- The upper boundary to use for deletions. Must be greater than0
-
equals
-
toString
-
hashCode
public int hashCode()
-