public class NGramCharModel
extends java.lang.Object
implements java.lang.Iterable<java.lang.String>
NGramCharModel can be used to create character ngrams.NGramModel}| Constructor and Description |
|---|
NGramCharModel()
Initializes an empty instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.CharSequence chars,
int minLength,
int maxLength)
Adds CharSequence that will be ngrammed into chars.
|
void |
add(java.lang.String ngram)
Adds one NGram, if it already exists the count increase by one.
|
boolean |
contains(java.lang.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(java.lang.Object obj) |
int |
getCount(java.lang.String ngram)
Retrieves the count of the given ngram.
|
int |
hashCode() |
java.util.Iterator<java.lang.String> |
iterator()
Retrieves an
Iterator over all String entries. |
int |
numberOfGrams()
Retrieves the total count of all Ngrams.
|
void |
remove(java.lang.String ngram)
Removes the specified tokens form the NGram model, they are just dropped.
|
void |
setCount(java.lang.String ngram,
int count)
Sets the count of an existing ngram.
|
int |
size()
Retrieves the number of
String entries in the current instance. |
java.lang.String |
toString() |
public int getCount(java.lang.String ngram)
ngram - an ngrampublic void setCount(java.lang.String ngram,
int count)
ngram - count - public void add(java.lang.String ngram)
ngram - public void add(java.lang.CharSequence chars,
int minLength,
int maxLength)
chars - minLength - maxLength - public void remove(java.lang.String ngram)
ngram - public boolean contains(java.lang.String ngram)
ngram - public int size()
String entries in the current instance.public java.util.Iterator<java.lang.String> iterator()
Iterator over all String entries.iterator in interface java.lang.Iterable<java.lang.String>public int numberOfGrams()
public void cutoff(int cutoffUnder,
int cutoffOver)
cutoffUnder - cutoffOver - public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2010 - 2023 Adobe. All Rights Reserved