Package org.apache.tika.langdetect.tika
Class LanguageProfile
- java.lang.Object
-
- org.apache.tika.langdetect.tika.LanguageProfile
-
public class LanguageProfile extends Object
Language profile based on ngram counts.- Since:
- Apache Tika 0.5
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_NGRAM_LENGTH
static boolean
useInterleaved
-
Constructor Summary
Constructors Constructor Description LanguageProfile()
LanguageProfile(int length)
LanguageProfile(String content)
LanguageProfile(String content, int length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Field Detail
-
DEFAULT_NGRAM_LENGTH
public static final int DEFAULT_NGRAM_LENGTH
- See Also:
- Constant Field Values
-
useInterleaved
public static boolean useInterleaved
-
-
Method Detail
-
getCount
public long getCount()
-
getCount
public long getCount(String ngram)
-
add
public void add(String ngram)
Adds a single occurrence of the given ngram to this profile.- Parameters:
ngram
- the ngram
-
add
public void add(String ngram, long count)
Adds multiple occurrences of the given ngram to this profile.- Parameters:
ngram
- the ngramcount
- number of occurrences to add
-
distance
public double distance(LanguageProfile that)
Calculates the geometric distance between this and the given other language profile.- Parameters:
that
- the other language profile- Returns:
- distance between the profiles
-
-