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 TypMethodeBeschreibungvoidadd(CharSequence ngram) Adds anngram.voidadd(CharSequence chars, int minLength, int maxLength) Adds aCharSequencethat will be ngrammed into chars.booleancontains(CharSequence ngram) Checks if the givenngramis contained in aNGramCharModel.voidcutoff(int cutoffUnder, int cutoffOver) Deletes all ngram which do appear less than thecutoffUndervalue and more often than thecutoffOvervalue.booleanintgetCount(CharSequence ngram) Retrieves the count of the givenngram.inthashCode()iterator()intRetrieves the total count of all Ngrams.voidremove(CharSequence ngram) Removes the specifiedngramis from aNGramCharModel.voidsetCount(CharSequence ngram, int count) Sets the count of an existingngram.intsize()Retrieves the number ofentriesin 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- Thengramto get the count for.- Gibt zurück:
- Count of the
ngramor0if it is not contained at all.
-
setCount
Sets the count of an existingngram.- Parameter:
ngram- Thengramto get the count for.count- The count of thengramto set.
-
add
Adds anngram. If it already exists the count increase by one.- Parameter:
ngram- TheCharSequenceto be added.
-
add
Adds aCharSequencethat will be ngrammed into chars.- Parameter:
chars- TheCharSequenceto 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 specifiedngramis from aNGramCharModel.- Parameter:
ngram- Thengramto remove. Ifnull, the model keeps its state.
-
contains
Checks if the givenngramis contained in aNGramCharModel.- Parameter:
ngram- Thengramto check. Ifnull, the model keeps its state.- Gibt zurück:
trueif the ngram is contained,falseotherwise.
-
size
public int size()Retrieves the number ofentriesin aNGramCharModel.- Gibt zurück:
- Number of different grams or
0if the model is empty.
-
iterator
- Angegeben von:
iteratorin 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 thecutoffUndervalue and more often than thecutoffOvervalue.- 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()
-