|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.tumba.ngram.EntryProfile
public class EntryProfile
A Profile
stores N-gram frequency information for a given textual string.
This is a profile implementation which builds itself from an input text.
Field Summary | |
---|---|
protected java.util.Map |
gramRanks
A Map storing N-grams and the associated ranking position. |
protected java.util.Map |
gramsStrings
A Map storing the textual String composing the N-grams. |
protected java.util.Map |
gramWeights
A Map storing N-grams and the associated weights. |
protected int |
theLimit
The lowest ranking position for storage in the N-gram profile. |
protected int |
theLowerLimit
The highest ranking position for storage in the N-gram profile. |
Constructor Summary | |
---|---|
EntryProfile(java.io.InputStream stream)
Constructor for the EntryProfile object. |
|
EntryProfile(java.io.InputStream stream,
int theLimit)
Constructor for the EntryProfile object. |
|
EntryProfile(java.io.InputStream stream,
int theLimit,
int theLowerLimit)
Constructor for the EntryProfile object. |
|
EntryProfile(java.lang.String fname)
Constructor for the EntryProfile object. |
|
EntryProfile(java.lang.String fname,
int theLimit)
Constructor for the EntryProfile object. |
|
EntryProfile(java.lang.String fname,
int theLimit,
int theLowerLimit)
Constructor for the EntryProfile object. |
Method Summary | |
---|---|
private void |
digestStream(java.io.InputStream stream)
Build tbe profile from an InputStream |
double |
getRank(NGram ng)
Gets the ranking position of a given N-gram. |
double |
getRank(java.lang.String ng)
Gets the ranking position of a given N-gram. |
double |
getWeight(NGram ng)
Gets the weighting score of a given N-gram. |
java.util.Iterator |
ngrams()
Returns an Iterator over the N-grams in this profile. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map gramRanks
Map
storing N-grams and the associated ranking position.
protected java.util.Map gramWeights
Map
storing N-grams and the associated weights.
protected java.util.Map gramsStrings
Map
storing the textual String composing the N-grams.
protected int theLimit
theLimit=400
only the top 400 highest occurring N-grams will be stored.
protected int theLowerLimit
theLowerLimit=200
the top 200 highest occurring N-grams will be skipped.
Constructor Detail |
---|
public EntryProfile(java.io.InputStream stream) throws java.io.IOException
EntryProfile
object.
stream
- An InputStream
from where to read the text,
in order to build the profile.
java.io.IOException
- A problem occured while reading from the InputStream
.public EntryProfile(java.io.InputStream stream, int theLimit) throws java.io.IOException
EntryProfile
object.
stream
- An InputStream
from where to read the text,
in order to build the profile.theLimit
- The lowest ranking position for storage in the N-gram profile.
java.io.IOException
- A problem occured while reading from the InputStream
.public EntryProfile(java.io.InputStream stream, int theLimit, int theLowerLimit) throws java.io.IOException
EntryProfile
object.
stream
- An InputStream
from where to read the text,
in order to build the profile.theLimit
- The lowest ranking position for storage in the N-gram profile.theLowerLimit
- The highest ranking position for storage in the N-gram profile.
java.io.IOException
- A problem occured while reading from the InputStream
.public EntryProfile(java.lang.String fname) throws java.io.IOException, java.io.FileNotFoundException
EntryProfile
object.
fname
- The pathname to the File with the text used to build the profile.
java.io.IOException
- A problem occured while reading from the file.
java.io.FileNotFoundException
- A problem occured while reading from the file.public EntryProfile(java.lang.String fname, int theLimit) throws java.io.IOException, java.io.FileNotFoundException
EntryProfile
object.
fname
- The pathname to the File with the text used to build the profile.theLimit
- The lowest ranking position for storage in the N-gram profile.
java.io.IOException
- A problem occured while reading from the file.
java.io.FileNotFoundException
- A problem occured while reading from the file.public EntryProfile(java.lang.String fname, int theLimit, int theLowerLimit) throws java.io.IOException, java.io.FileNotFoundException
EntryProfile
object.
fname
- The pathname to the File with the text used to build the profile.theLimit
- The lowest ranking position for storage in the N-gram profile.theLowerLimit
- The highest ranking position for storage in the N-gram profile.
java.io.IOException
- A problem occured while reading from the file.
java.io.FileNotFoundException
- A problem occured while reading from the file.Method Detail |
---|
private final void digestStream(java.io.InputStream stream) throws java.io.IOException
InputStream
stream
- An InputStream
from where to read the text,
in order to build the profile.
java.io.IOException
- A problem occured while reading from the InputStream
.public double getRank(NGram ng)
getRank
in interface Profile
ng
- An N-Gram
public double getWeight(NGram ng)
getWeight
in interface Profile
ng
- An N-Gram
public double getRank(java.lang.String ng)
ng
- A String with the characters of the N-Gram
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |