|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.tumba.ngram.DataProfile
public class DataProfile
A Profile
stores N-gram frequency information for a given textual string.
This is a profile implementation which reads itself from a text file.
Field Summary | |
---|---|
protected java.lang.String |
name
The name for the Profile (usually equal to the filename from where it was read). |
protected java.util.List |
rankedNGrams
The list of N-grams in this Profile. |
Constructor Summary | |
---|---|
DataProfile(java.lang.String name,
java.io.InputStream stream)
Constructor for DataProfile . |
Method Summary | |
---|---|
java.lang.String |
getName()
Gets the name of the Profile. |
double |
getRank(NGram gram)
Gets the ranking position of a given N-gram. |
int |
getSize()
Gets the number of N-grams in the Profile. |
double |
getWeight(NGram gram)
Gets the weighting score of a given N-gram. |
java.util.Iterator |
ngrams()
Returns an Iterator over the N-grams in this profile. |
private void |
readStream(java.io.InputStream stream)
Reads the Profile data from an InputStream . |
java.lang.String |
toString()
Converts this profile to a String Object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected java.util.List rankedNGrams
Constructor Detail |
---|
public DataProfile(java.lang.String name, java.io.InputStream stream)
DataProfile
.
name
- The name of the profile.stream
- An InputStream
from where to read the Profile.Method Detail |
---|
public java.lang.String getName()
public double getRank(NGram gram)
getRank
in interface Profile
gram
- An N-Gram
public double getWeight(NGram gram)
getWeight
in interface Profile
gram
- An N-Gram
public int getSize()
public java.util.Iterator ngrams()
Iterator
over the N-grams in this profile.
ngrams
in interface Profile
Iterator
over the N-grams in this profile.private final void readStream(java.io.InputStream stream)
Profile
data from an InputStream
.
stream
- The InputStream
from where to read the Profile
.public java.lang.String toString()
toString
in class java.lang.Object
Profile
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |