|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.aitools.ie.keyphraseextraction.Phrase
public class Phrase
A class to represent a phrase. A phrase is a sequence of one or more words that forms a piece of written or spoken language. This class is a common object to implement several concepts used by different key phrase extraction algorithms such as n-grams or head head noun phrases.
Constructor Summary | |
---|---|
Phrase()
The default constructor. |
|
Phrase(java.util.Collection<java.lang.String> words,
double score)
Explicit constructor. |
|
Phrase(java.lang.String word,
double score)
Explicit constructor. |
Method Summary | |
---|---|
Phrase |
appendWord(java.lang.String word)
Adds a new word to the end of this phrase. |
void |
clear()
Deletes all words of this phrase and zeros its score. |
int |
compareTo(Phrase phrase)
Compares this object with the specified object for order. |
void |
decrementScore(double decrement)
Decrements the score of this phrase. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getFirstWord()
Returns the first word of this phrase. |
java.lang.String |
getLastWord()
Returns the last word of this phrase. |
double |
getScore()
Returns an algorithm-dependent score value. |
java.lang.String |
getString()
Returns the entire phrase as one string. |
java.lang.String |
getWord(int index)
Returns the word at the specified position. |
int |
hashCode()
|
void |
incrementScore(double increment)
Increments the score of this phrase. |
boolean |
isEmpty()
Checks if the phrase has zero words. |
java.util.Iterator<java.lang.String> |
iterator()
|
Phrase |
prependWord(java.lang.String word)
Adds a new word to the beginning of this phrase. |
java.lang.String |
removeFirstWord()
Removes and returns the first word of this phrase. |
java.lang.String |
removeLastWord()
Removes and returns the last word of this phrase. |
void |
setScore(double score)
Sets the algorithm-dependent score value of this phrase. |
void |
setWord(int index,
java.lang.String word)
Replaces the index-th word of the phrase. |
int |
size()
Returns the number of word in this phrase. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Phrase()
public Phrase(java.lang.String word, double score)
public Phrase(java.util.Collection<java.lang.String> words, double score)
Method Detail |
---|
public Phrase appendWord(java.lang.String word)
word
- the word to append.
public void clear()
public int compareTo(Phrase phrase)
compareTo
in interface java.lang.Comparable<Phrase>
Comparable.compareTo(Object)
public void decrementScore(double decrement)
decrement
- the value to subtract from the current score.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String getFirstWord()
java.util.NoSuchElementException
- if the phrase is empty.public java.lang.String getLastWord()
java.util.NoSuchElementException
- if the phrase is empty.public double getScore()
compareTo(Phrase)
method.
public java.lang.String getString()
public java.lang.String getWord(int index)
index
- the position of the element to return.
java.lang.IndexOutOfBoundsException
- if index is invalid.public int hashCode()
hashCode
in class java.lang.Object
public void incrementScore(double increment)
increment
- the value to add to the current score.public boolean isEmpty()
public java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
public Phrase prependWord(java.lang.String word)
word
- the word to prepend.
public java.lang.String removeFirstWord()
java.util.NoSuchElementException
- if the phrase is empty.public java.lang.String removeLastWord()
java.util.NoSuchElementException
- if the phrase is empty.public void setScore(double score)
score
- the score value.public void setWord(int index, java.lang.String word)
index
- the position of the word to replace.word
- the new word to set.
java.lang.IndexOutOfBoundsException
- if index is invalid.public int size()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |