public class LanguageProfile extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NGRAM_LENGTH |
Constructor and Description |
---|
LanguageProfile() |
LanguageProfile(int length) |
LanguageProfile(String content) |
LanguageProfile(String content,
int length) |
Modifier and Type | Method and Description |
---|---|
void |
add(String ngram)
Adds a single occurrence of the given ngram to this profile.
|
void |
add(String ngram,
long count)
Adds multiple occurrences of the given ngram to this profile.
|
double |
distance(LanguageProfile that)
Calculates the geometric distance between this and the given
other language profile.
|
long |
getCount() |
long |
getCount(String ngram) |
String |
toString() |
public static final int DEFAULT_NGRAM_LENGTH
public LanguageProfile(int length)
public LanguageProfile()
public LanguageProfile(String content, int length)
public LanguageProfile(String content)
public long getCount()
public long getCount(String ngram)
public void add(String ngram)
ngram
- the ngrampublic void add(String ngram, long count)
ngram
- the ngramcount
- number of occurrences to addpublic double distance(LanguageProfile that)
that
- the other language profileCopyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.