|
Jacson | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.spieleck.app.cngram.NGramProfileImpl
public class NGramProfileImpl
Actual implementation of a NGramProfile Methods are provided to build new NGramProfiles profiles.
Field Summary | |
---|---|
static int |
DEFAULT_MAX_NGRAM_LENGTH
default max length of ngram |
static int |
DEFAULT_MIN_NGRAM_LENGTH
default min length of ngram. |
static char |
SEPARATOR
separator char |
Fields inherited from interface de.spieleck.app.cngram.NGramProfile |
---|
CHAR_SEQ_COMPARATOR, FINISHREAD_STR, NGRAM_PROFILE_EXTENSION, NO_NGRAM, NORMALIZATION_STR |
Constructor Summary | |
---|---|
NGramProfileImpl(java.lang.String name)
Create a new ngram profile with default lengths. |
|
NGramProfileImpl(java.lang.String name,
int minlen,
int maxlen)
Create a new ngram profile |
Method Summary | |
---|---|
void |
addNGrams(java.lang.CharSequence word)
Add ngrams from a single word to this profile |
void |
analyze(java.lang.CharSequence text)
Analyze a piece of text |
void |
clear()
|
static NGramProfileImpl |
createProfile(java.lang.String name,
java.io.InputStream is,
java.lang.String encoding)
Create a new Language profile from (preferably quite large) text file |
NGram |
get(java.lang.CharSequence seq)
|
int |
getCount()
|
java.lang.String |
getName()
|
int |
getNormalization()
Get the normalization of all NGrams contained. |
java.util.Iterator |
getSorted()
Return sorted ngrams |
void |
load(java.io.InputStream is)
Loads a ngram profile from InputStream (assumes UTF-8 encoded content) |
void |
save(java.io.OutputStream os)
Writes NGramProfile content into OutputStream, content is outputted with UTF-8 encoding |
void |
setName(java.lang.String name)
|
void |
setRestricted(java.util.Set restricted)
|
java.lang.String |
toString()
Return ngramprofile as text |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char SEPARATOR
public static final int DEFAULT_MIN_NGRAM_LENGTH
public static final int DEFAULT_MAX_NGRAM_LENGTH
Constructor Detail |
---|
public NGramProfileImpl(java.lang.String name)
name
- Name of profilepublic NGramProfileImpl(java.lang.String name, int minlen, int maxlen)
name
- Name of profileminlen
- min length of ngram sequencesmaxlen
- max length of ngram sequencesMethod Detail |
---|
public void setRestricted(java.util.Set restricted)
public void analyze(java.lang.CharSequence text)
text
- the text to be analyzedpublic void clear()
public int getCount()
getCount
in interface NGramProfile
public int getNormalization()
NGramProfile
getNormalization
in interface NGramProfile
public void addNGrams(java.lang.CharSequence word)
word
- public java.util.Iterator getSorted()
NGramProfile
getSorted
in interface NGramProfile
public NGram get(java.lang.CharSequence seq)
get
in interface NGramProfile
public java.lang.String toString()
toString
in class java.lang.Object
public void load(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static NGramProfileImpl createProfile(java.lang.String name, java.io.InputStream is, java.lang.String encoding) throws java.io.IOException
name
- name of profileis
- encoding
- encoding of stream
java.io.IOException
public void save(java.io.OutputStream os) throws java.io.IOException
os
- Stream to output to
java.io.IOException
public java.lang.String getName()
getName
in interface NGramProfile
public void setName(java.lang.String name)
name
- The name to set.
|
spieleck.de | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |