public class Term extends Object
Representation of a keyword of a KnowledgeChunk
with associated relevance and frequency.
This is in fact an association between a keyword and a knowledge chunk from which the keyword has been extracted.
The same keyword could appear in more than one Term
instance, every time connected with different
KnowledgeChunk
s and, possibly, different frequency and relevance.
KnowledgeChunk
Modifier | Constructor and Description |
---|---|
protected |
Term()
Only Hibernate and KnowledgeChunk are able to instantiate this object.
|
protected |
Term(KnowledgeChunk kc,
String value,
double relevance,
Integer frequency)
Direct use of this constructor is discouraged.
|
Modifier and Type | Method and Description |
---|---|
TermTransformation |
addTransformation(String transformationName,
String transformationValue)
Associate to this
Term a related word. |
boolean |
equals(Object obj)
Evaluate if the current
Term is equal to the given object. |
Integer |
getFrequency()
Getter for the
frequency field. |
Integer |
getId()
Getter for the identifier of this object in the linked database.
|
KnowledgeChunk |
getKc()
Getter for the
kc field. |
Double |
getRelevance()
Getter for the
relevance field. |
Set<TermTransformation> |
getTransformations()
Get all the term transformations associated with the current
Term . |
String |
getValue()
Getter for the keyword value.
|
int |
hashCode()
Hash code is given by the hash code of the string composed by the value of this term + the id of the owner KnowledgeChunk.
|
void |
setFrequency(Integer frequency)
Setter for the
frequency field. |
protected void |
setId(Integer id)
Method used by Hibernate to import database objects.
|
void |
setKc(KnowledgeChunk kc)
Setter for the
kc field. |
void |
setRelevance(Double relevance)
Setter for the
relevance field. |
protected void |
setTransformations(Set<TermTransformation> transformations)
Set the term transformations associated with the current
Term . |
protected void |
setValue(String termValue)
Setter for the keyword value.
|
String |
toString()
Return a string representation of this
Term . |
protected Term()
protected Term(KnowledgeChunk kc, String value, double relevance, Integer frequency)
Direct use of this constructor is discouraged. Use KnowledgeChunk.addTerm
instead.
kc
- the belonging KnowledgeChunk
value
- the real term in string representation.relevance
- the relevance of this keyword(term) for kc
frequency
- the frequency of this keyword(term) for kc
KnowledgeChunk.addTerm(String, Double, Integer)
public int hashCode()
public boolean equals(Object obj)
Evaluate if the current Term
is equal to the given object. Equality is positive if and only
if the given object is an instance of Term, refers to the same KnowledgeChunk (using KnowledgeChunk equality) of the
current Term and contains the same string value (using String equality).
public TermTransformation addTransformation(String transformationName, String transformationValue)
Term
a related word. Examples of possible transformations are stemming and
lemmatization.transformationName
- The name of the transformation applied to the original term to obtain the related
word.transformationValue
- The value of the transformed wordTerm
public String toString()
Term
.public String getValue()
Getter for the keyword value.
Term
instance.protected void setValue(String termValue)
Setter for the keyword value.
termValue
- a string representing the keyword wrapped by this Term
instance.public Integer getId()
Getter for the identifier of this object in the linked database.
protected void setId(Integer id)
Method used by Hibernate to import database objects. Direct use is discouraged.
id
- public Integer getFrequency()
Getter for the frequency
field.
kc
.public void setFrequency(Integer frequency)
Setter for the frequency
field.
frequency
- the frequency of this term wrapper as the number of its occurrences in kc
.public KnowledgeChunk getKc()
Getter for the kc
field.
value
keyword.public void setKc(KnowledgeChunk kc)
Setter for the kc
field.
kc
- the kc owner of the value
keyword.public void setRelevance(Double relevance)
Setter for the relevance
field.
relevance
- the relevance of the wrapped term for the kc
.public Double getRelevance()
Getter for the relevance
field.
kc
.public Set<TermTransformation> getTransformations()
Term
.Term
.protected void setTransformations(Set<TermTransformation> transformations)
Term
.transformations
- a set of all the term associated with the current Term
.