tml.corpus
Class Term

java.lang.Object
  extended by tml.corpus.Term

public class Term
extends java.lang.Object

The Term class represents a unique word within a Corpus. It is stored by the Corpus' Dictionary and it contain links to all the TextPassages that contain the Term.

The class also contains some statistics like the total number of times it appears in a Corpus.

The following code shows how to use the Terms from a TextDocument

 ...
        TextDocument document = .....;
        List<Term> terms = document.getSentenceCorpus().getDictionary().getTerms();
        for(Term term : terms) {
                System.out.println("Term:" + term.getTerm());
                System.out.println("DF:" + term.getDocumentFrequency());
                System.out.println("TF:" + term.getTermFrequency());
        }
 

Author:
Jorge Villalon

Constructor Summary
Term(java.lang.String term, int index)
          Creates a new Term, with an index defined by an external source (usually a Dictionary.
 
Method Summary
 void addTermAppearance(TextPassage textPassage, double termFrequency)
          Adds a new TextPassage to the Term
 int getDocumentFrequency()
           
 int getIndex()
           
 java.lang.String getTerm()
           
 int getTermGlobalFrequency()
           
 double getTermGlobalFrequencyMean()
           
 java.util.List<TextPassage> getTextPassages()
           
 boolean isConcept()
           
 void setConcept(boolean isConcept)
           
 void setIndex(int index)
          Changes the value of the index for the Term within a Corpus
 java.lang.String toString()
          The default string for a Term is it's own word
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Term

public Term(java.lang.String term,
            int index)
Creates a new Term, with an index defined by an external source (usually a Dictionary.

Parameters:
term -
index -
Method Detail

setConcept

public void setConcept(boolean isConcept)
Parameters:
isConcept - if the Term is a Concept

addTermAppearance

public void addTermAppearance(TextPassage textPassage,
                              double termFrequency)
Adds a new TextPassage to the Term

Parameters:
textPassage -
termFrequency -

getDocumentFrequency

public int getDocumentFrequency()
Returns:
the document frequency of the term, i.e. in how many documents does it appears.

getIndex

public int getIndex()
Returns:
the index of the Term within its Dictionary

getTerm

public java.lang.String getTerm()
Returns:
the word that represents the Term

getTermGlobalFrequency

public int getTermGlobalFrequency()
Returns:
the term frequency of the Term, i.e. how many times the word appears in the Corpus.

getTermGlobalFrequencyMean

public double getTermGlobalFrequencyMean()
Returns:
the mean appearance of the Term along the TextPassages of a Corpus.

getTextPassages

public java.util.List<TextPassage> getTextPassages()
Returns:
the list of TextPassages to which the Term belongs

setIndex

public void setIndex(int index)
Changes the value of the index for the Term within a Corpus

Parameters:
index -

toString

public java.lang.String toString()
The default string for a Term is it's own word

Overrides:
toString in class java.lang.Object

isConcept

public boolean isConcept()
Returns:
if the Term correspond to a potential concept