ca.site.elkb
Class Paragraph

java.lang.Object
  extended by ca.site.elkb.Paragraph

public class Paragraph
extends java.lang.Object

Represents a Roget's Thesaurus Paragraph. A Paragraph is defined by the following attributes:

Version:
1.4 2013
Author:
Mario Jarmasz and Alistsair Kennedy

Constructor Summary
Paragraph()
          Default constructor.
Paragraph(int head, int para, java.lang.String p)
          Constructor which sets the Head number, Paragraph number and part-of-speech.
Paragraph(int head, int para, java.lang.String key, java.lang.String p)
          Constructor which sets the Head number, Paragraph number, keyword, and part-of-speech.
 
Method Summary
 void addSG(SG sgObj)
          Adds a Semicolon Group, repreented as a string, to the Paragraph.
 void addSG(java.lang.String sg)
          Adds a Semicolon Group, repreented as a string, to the Paragraph.
 boolean equals(java.lang.Object anObject)
          Compares this paragraph to the specified object.
 java.lang.String format()
          Converts to a string representation, similar to the printed format, the Paragraph object.
 java.util.ArrayList<java.lang.String> getAllWordList()
          Returns all of the words and phrases in a paragraph.
 int getCRefCount()
          Returns the number of Cross-references in this Paragraph.
 int getHeadNum()
          Returns the Head number of this Paragraph.
 java.lang.String getParaKey()
          Returns the keyword of this Paragraph.
 int getParaNum()
          Returns the number of this Paragraph.
 java.lang.String getPOS()
          Returns the part-of-speech of this Paragraph.
 int getSeeCount()
          Returns the number of See references in this Paragraph.
 SG getSG(int index)
          Returns the Semicolon Group at the specified position in the array of Semicolon Groups.
 SG getSG(java.lang.String word)
          Returns the the first Semicolon Group in this Paragraph which contains the given word.
 int getSGCount()
          Returns the number of Semicolon Groups in this Paragraph.
 SG getSGinPhrase(java.lang.String word)
          Returns the the first Semicolon Group in this Paragraph which contains the given word either on its own or in a phrase.
 java.util.ArrayList<SG> getSGList()
          Returns the array of Semicolon Groups of this Paragraph.
 int getWordCount()
          Returns the number of words in this Paragraph.
 java.lang.String parseParaKey(java.lang.String line)
          Extracts the keyword from a Semicolon Group represented as a string.
 void print()
          Prints the contents of this Paragraph to the standard output.
 void printAllSG()
          Prints all the contents of all Semicolon Groups, including references, without any special formatting.
 void printAllWords()
          Prints all of the words and phrases in the Paragraph on a separate line to the standard output.
 void setHeadNum(int num)
          Sets the Head number of this Paragraph.
 void setParaKey(java.lang.String key)
          Sets the keyword of this Paragraph.
 void setParaNum(int num)
          Sets the number of this Paragraph.
 void setPOS(java.lang.String p)
          Sets the part-of-speech of this Paragraph.
 java.lang.String toString()
          Converts to a string representation the Paragraph object.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Paragraph

public Paragraph()
Default constructor.


Paragraph

public Paragraph(int head,
                 int para,
                 java.lang.String p)
Constructor which sets the Head number, Paragraph number and part-of-speech.

Parameters:
head -
para -
p -

Paragraph

public Paragraph(int head,
                 int para,
                 java.lang.String key,
                 java.lang.String p)
Constructor which sets the Head number, Paragraph number, keyword, and part-of-speech.

Parameters:
head -
para -
key -
p -
Method Detail

getHeadNum

public int getHeadNum()
Returns the Head number of this Paragraph.

Returns:
head number

setHeadNum

public void setHeadNum(int num)
Sets the Head number of this Paragraph.

Parameters:
num -

getParaNum

public int getParaNum()
Returns the number of this Paragraph.

Returns:
paragraph number

setParaNum

public void setParaNum(int num)
Sets the number of this Paragraph.

Parameters:
num -

getParaKey

public java.lang.String getParaKey()
Returns the keyword of this Paragraph.

Returns:
paragraph key

setParaKey

public void setParaKey(java.lang.String key)
Sets the keyword of this Paragraph.

Parameters:
key -

getPOS

public java.lang.String getPOS()
Returns the part-of-speech of this Paragraph.

Returns:
POS

setPOS

public void setPOS(java.lang.String p)
Sets the part-of-speech of this Paragraph.

Parameters:
p -

getWordCount

public int getWordCount()
Returns the number of words in this Paragraph.

Returns:
number of words

getCRefCount

public int getCRefCount()
Returns the number of Cross-references in this Paragraph.

Returns:
number of references

getSeeCount

public int getSeeCount()
Returns the number of See references in this Paragraph.

Returns:
number of see references

getSGCount

public int getSGCount()
Returns the number of Semicolon Groups in this Paragraph.

Returns:
semicolon group count

getSGList

public java.util.ArrayList<SG> getSGList()
Returns the array of Semicolon Groups of this Paragraph.

Returns:
ArrayList of semicolon groups

addSG

public void addSG(java.lang.String sg)
Adds a Semicolon Group, repreented as a string, to the Paragraph. This method parses a string similar to: ^sg>^i>frenzy, ^/i>monomania, furore, frenetic condition,;^/sg>.

Parameters:
sg -

addSG

public void addSG(SG sgObj)
Adds a Semicolon Group, repreented as a string, to the Paragraph. This method takes an already created semicolon group SG as an argument.

Parameters:
sgObj -

getSG

public SG getSG(java.lang.String word)
Returns the the first Semicolon Group in this Paragraph which contains the given word.

Parameters:
word -
Returns:
semicolon group

getSGinPhrase

public SG getSGinPhrase(java.lang.String word)
Returns the the first Semicolon Group in this Paragraph which contains the given word either on its own or in a phrase.

Parameters:
word -
Returns:
semicolon group

getSG

public SG getSG(int index)
Returns the Semicolon Group at the specified position in the array of Semicolon Groups.

Parameters:
index -
Returns:
semicolon group

parseParaKey

public java.lang.String parseParaKey(java.lang.String line)
Extracts the keyword from a Semicolon Group represented as a string. For example, the keyword existence is returned when the following string is supplied: ^sg>^i>existence, ^/i>being, entity;^/sg>

Parameters:
line -
Returns:
paragraph key

toString

public java.lang.String toString()
Converts to a string representation the Paragraph object.

Overrides:
toString in class java.lang.Object

print

public void print()
Prints the contents of this Paragraph to the standard output.


format

public java.lang.String format()
Converts to a string representation, similar to the printed format, the Paragraph object.

Returns:
format information

equals

public boolean equals(java.lang.Object anObject)
Compares this paragraph to the specified object. The result is true if the argument is not null and is a Paragraph object that has the same paraKey as this object.

Overrides:
equals in class java.lang.Object
Parameters:
anObject - the object to compare this Paragraph against.
Returns:
true if the Paragraph have the same paraKey; false otherwise.
See Also:
String.compareTo(java.lang.String), String.equalsIgnoreCase(java.lang.String)

getAllWordList

public java.util.ArrayList<java.lang.String> getAllWordList()
Returns all of the words and phrases in a paragraph.

Returns:
ArrayList of all words

printAllWords

public void printAllWords()
Prints all of the words and phrases in the Paragraph on a separate line to the standard output. The words and phrasses are printed using the following format: word:keyword:headnum:pos


printAllSG

public void printAllSG()
Prints all the contents of all Semicolon Groups, including references, without any special formatting. Allows to compare Semicolon Groups to WordNet synsets.