cic.wordnet
Class ParsedSynset

java.lang.Object
  extended by cic.wordnet.ParsedSynset
All Implemented Interfaces:
java.lang.Comparable<java.lang.Object>

public class ParsedSynset
extends java.lang.Object
implements java.lang.Comparable<java.lang.Object>

Class for storing a synset data.

Author:
Francisco Viveros-Jiménez

Field Summary
(package private)  java.util.ArrayList<java.lang.String> bagOfWords
          Lemmas extracted from the loaded samples for this synset.
(package private)  java.lang.String pos
          POS tag of this synset.
(package private)  java.util.HashMap<java.lang.String,java.util.ArrayList<Relation>> relations
          A HashMap containing all the relations of this synset.
(package private)  java.util.ArrayList<java.lang.String> samples
          Loaded samples (glosses are considered samples if loaded).
(package private)  java.lang.String sid
          Id of this synset in the format "number_POS".
(package private)  java.util.ArrayList<java.lang.String> synonyms
          Words of this synset.
 
Constructor Summary
ParsedSynset(java.lang.String sid, java.lang.String pos, java.util.ArrayList<java.lang.String> synonyms)
          Creates a plain synset with no samples and no bag of words..
 
Method Summary
 void addBagOfWords(java.lang.String sample, java.lang.String[] parsedSamples)
          Stores a new sample of this synset.
 void addRelation(java.lang.String type, Relation relation)
          Adds a semantical relation with another synset.
 int compareTo(java.lang.Object object)
          compareTo allows comparisons against other ParsedSynset object or a String.
 boolean equals(java.lang.Object object)
          equals allows comparisons against other ParsedSynset object or a String.
 java.util.ArrayList<java.lang.String> getBagOfWords()
          Lemmas extracted from the samples loaded for this synset.
 java.lang.String getPos()
          The POS tag.
 java.util.HashMap<java.lang.String,java.util.ArrayList<Relation>> getRelations()
          This synset's relations
 java.util.ArrayList<java.lang.String> getSamples()
          The loaded samples.
 java.lang.String getSid()
          The synsetId.
 java.util.ArrayList<java.lang.String> getSyds(java.lang.String relation)
          Return all the synsetIds from an specific relation type.
 java.util.ArrayList<java.lang.String> getSynonyms()
          Words of this synset.
 java.lang.String toString()
          Returns "synsetId: [synsetWord1,...
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sid

java.lang.String sid
Id of this synset in the format "number_POS".


pos

java.lang.String pos
POS tag of this synset.


synonyms

java.util.ArrayList<java.lang.String> synonyms
Words of this synset.


bagOfWords

java.util.ArrayList<java.lang.String> bagOfWords
Lemmas extracted from the loaded samples for this synset.


samples

java.util.ArrayList<java.lang.String> samples
Loaded samples (glosses are considered samples if loaded).


relations

java.util.HashMap<java.lang.String,java.util.ArrayList<Relation>> relations
A HashMap containing all the relations of this synset. The key its the WordNet code for a type a relation. The value its a list containing all the relations of this kind.

Constructor Detail

ParsedSynset

public ParsedSynset(java.lang.String sid,
                    java.lang.String pos,
                    java.util.ArrayList<java.lang.String> synonyms)
Creates a plain synset with no samples and no bag of words..

Parameters:
sid - The synsetID of this synset.
pos - The POS tag of this synset.
synonyms - The lemmas of this synset.
Method Detail

getSid

public java.lang.String getSid()
The synsetId.

Returns:
The synsetId.

getPos

public java.lang.String getPos()
The POS tag.

Returns:
The POS tag.

getSynonyms

public java.util.ArrayList<java.lang.String> getSynonyms()
Words of this synset.

Returns:
The words that form this synset.

getBagOfWords

public java.util.ArrayList<java.lang.String> getBagOfWords()
Lemmas extracted from the samples loaded for this synset.

Returns:
The bag of words.

getSamples

public java.util.ArrayList<java.lang.String> getSamples()
The loaded samples.

Returns:
Samples retrieved from different sources.

getRelations

public java.util.HashMap<java.lang.String,java.util.ArrayList<Relation>> getRelations()
This synset's relations

Returns:
The HashMap storing all the relations of this synset.

getSyds

public java.util.ArrayList<java.lang.String> getSyds(java.lang.String relation)
Return all the synsetIds from an specific relation type. E.g., "@" for hypernyms. See Wordnet's wninput(5WN) page for further details.

Parameters:
relation - The relation code.
Returns:
An ArrayList with the corresponding synsetIds or an empty ArrayList if there wasn't any relations of the specific type.

toString

public java.lang.String toString()
Returns "synsetId: [synsetWord1,...,synsetWordN]"

Overrides:
toString in class java.lang.Object

addBagOfWords

public void addBagOfWords(java.lang.String sample,
                          java.lang.String[] parsedSamples)
Stores a new sample of this synset.

Parameters:
sample - The added sample.
parsedSamples - Lemmatized words of the added sample

addRelation

public void addRelation(java.lang.String type,
                        Relation relation)
Adds a semantical relation with another synset.

Parameters:
type - WordNet code of the relation.
relation - The relation to be stored.

equals

public boolean equals(java.lang.Object object)
equals allows comparisons against other ParsedSynset object or a String. The sid field its used to perform both comparisons.

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object object)
compareTo allows comparisons against other ParsedSynset object or a String. The sid field its used to perform both comparisons.

Specified by:
compareTo in interface java.lang.Comparable<java.lang.Object>