Constructor and Description |
---|
NGramCharModel()
Initializes an empty instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(CharSequence chars,
int minLength,
int maxLength)
Adds CharSequence that will be ngrammed into chars.
|
void |
add(String ngram)
Adds one NGram, if it already exists the count increase by one.
|
boolean |
contains(String ngram)
Checks fit he given tokens are contained by the current instance.
|
void |
cutoff(int cutoffUnder,
int cutoffOver)
Deletes all ngram which do appear less than the cutoffUnder value
and more often than the cutoffOver value.
|
boolean |
equals(Object obj) |
int |
getCount(String ngram)
Retrieves the count of the given ngram.
|
int |
hashCode() |
Iterator<String> |
iterator()
|
int |
numberOfGrams()
Retrieves the total count of all Ngrams.
|
void |
remove(String ngram)
Removes the specified tokens form the NGram model, they are just dropped.
|
void |
setCount(String ngram,
int count)
Sets the count of an existing ngram.
|
int |
size()
Retrieves the number of
String entries in the current instance. |
String |
toString() |
forEach, spliterator
public int getCount(String ngram)
ngram
- an ngrampublic void setCount(String ngram, int count)
ngram
- count
- public void add(String ngram)
ngram
- public void add(CharSequence chars, int minLength, int maxLength)
chars
- minLength
- maxLength
- public void remove(String ngram)
ngram
- public boolean contains(String ngram)
ngram
- public int size()
String
entries in the current instance.public int numberOfGrams()
public void cutoff(int cutoffUnder, int cutoffOver)
cutoffUnder
- cutoffOver
- Copyright © 2021 The Apache Software Foundation. All rights reserved.