@Deprecated public class LanguageProfilerBuilder extends Object
Constructor and Description |
---|
LanguageProfilerBuilder(String name)
Deprecated.
Constructs a new ngram profile where minlen=3, maxlen=3
|
LanguageProfilerBuilder(String name,
int minlen,
int maxlen)
Deprecated.
Constructs a new ngram profile
|
Modifier and Type | Method and Description |
---|---|
void |
add(StringBuffer word)
Deprecated.
Adds ngrams from a single word to this profile
|
void |
analyze(StringBuilder text)
Deprecated.
Analyzes a piece of text
|
static LanguageProfilerBuilder |
create(String name,
InputStream is,
String encoding)
Deprecated.
Creates a new Language profile from (preferably quite large - 5-10k of
lines) text file
|
String |
getName()
Deprecated.
|
float |
getSimilarity(LanguageProfilerBuilder another)
Deprecated.
Calculates a score how well NGramProfiles match each other
|
List<org.apache.tika.language.LanguageProfilerBuilder.NGramEntry> |
getSorted()
Deprecated.
Returns a sorted list of ngrams (sort done by 1.
|
void |
load(InputStream is)
Deprecated.
Loads a ngram profile from an InputStream (assumes UTF-8 encoded content)
|
static void |
main(String[] args)
Deprecated.
main method used for testing only
|
protected void |
normalize()
Deprecated.
Normalizes the profile (calculates the ngrams frequencies)
|
void |
save(OutputStream os)
Deprecated.
Writes NGramProfile content into OutputStream, content is outputted with
UTF-8 encoding
|
String |
toString()
Deprecated.
|
public LanguageProfilerBuilder(String name, int minlen, int maxlen)
name
- is the name of the profileminlen
- is the min length of ngram sequencesmaxlen
- is the max length of ngram sequencespublic LanguageProfilerBuilder(String name)
name
- is a name of profile, usually two length stringpublic String getName()
public void add(StringBuffer word)
word
- is the word to addpublic void analyze(StringBuilder text)
text
- the text to be analyzedprotected void normalize()
public List<org.apache.tika.language.LanguageProfilerBuilder.NGramEntry> getSorted()
public float getSimilarity(LanguageProfilerBuilder another) throws TikaException
another
- ngram profile to compare againstTikaException
- if could not calculate a scorepublic void load(InputStream is) throws IOException
is
- the InputStream to readIOException
public static LanguageProfilerBuilder create(String name, InputStream is, String encoding) throws TikaException
name
- to be given for the profileis
- a stream to be readencoding
- is the encoding of streamTikaException
- if could not create a language profilepublic void save(OutputStream os) throws IOException
os
- the Stream to output toIOException
public static void main(String[] args)
args
- Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.