edu.northwestern.at.monk.model
Class Word

java.lang.Object
  extended by edu.northwestern.at.monk.model.TaggedObject
      extended by edu.northwestern.at.monk.model.Word
All Implemented Interfaces:
java.lang.Comparable<Word>

public class Word
extends TaggedObject
implements java.lang.Comparable<Word>

A word.

See Also:
MONK Datastore Overview, Licensing Agreement

Nested Class Summary
static class Word.Comparator
          A multi-column word comparator.
static class Word.SortOption
          Word sorting options.
 
Method Summary
 int compareTo(Word other)
          Compares this instance with another.
 boolean equals(java.lang.Object obj)
          Returns true if this object equals some other object.
static java.util.Collection<Word> find(java.util.Collection<SearchCriterion> criteria)
          Finds words.
static java.util.Collection<Word> find(SearchCriteria criteria)
          Finds words.
static java.util.Collection<Word> find(SearchCriterion... criteria)
          Finds words.
static java.lang.String formatAsString(Word... words)
          Formats a sequence of words as a string.
static Word get(java.lang.String tag)
          Gets a word by tag.
 long getColOrdinal()
          Gets the collocation ordinal.
 java.lang.String getContext()
          Gets the context.
 Corpus getCorpus()
          Gets the corpus.
 boolean getEndOfSentence()
          Returns true if the word is at the end of a sentence.
 Lemma getFirstLemma()
          Gets the first lemma.
 Pos getFirstPos()
          Gets the first part of speech.
 boolean getLineBreak()
          Returns true if a line break follows this word.
 int getNumWordParts()
          Gets the number of word parts.
 boolean getParatext()
          Returns true if the word is paratext, false if it normal text.
 boolean getParBreak()
          Returns true if a paragraph break follows this word.
 java.lang.String getPuncAfter()
          Gets the punctuation after.
 java.lang.String getPuncBefore()
          Gets the punctuation before.
 long getSentenceInWorkOrdinal()
          Gets the sentence in work ordinal.
 Spelling getSpelling()
          Gets the spelling.
 java.lang.String getStandardSpelling()
          Gets the standard spelling.
 java.lang.String getToken()
          Gets the token.
 boolean getVerse()
          Returns true if the word is verse, false if it prose.
 long getWordInSentenceOrdinal()
          Gets the word in sentence ordinal.
 WordPart[] getWordParts()
          Gets the word parts.
 Work getWork()
          Gets the work.
 long getWorkOrdinal()
          Gets the work ordinal.
 WorkPart getWorkPart()
          Gets the work part.
 int hashCode()
          Returns a hash code for this object.
static Word[] sort(java.util.Collection<Word> collection, Word.SortOption... options)
          Sorts a collection of words.
static void sort(Word[] array, Word.SortOption... options)
          Sorts an array of words.
 
Methods inherited from class edu.northwestern.at.monk.model.TaggedObject
getTag
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

find

public static java.util.Collection<Word> find(SearchCriterion... criteria)
                                       throws ModelException
Finds words.

Parameters:
criteria - Search criteria.
Returns:
Collection of words, in an undefined order. If you want the result to be ordered, you must call a sort method.
Throws:
ModelException -
Unable to execute search

find

public static java.util.Collection<Word> find(java.util.Collection<SearchCriterion> criteria)
                                       throws ModelException
Finds words.

Parameters:
criteria - Collection of search criteria.
Returns:
Collection of words, in an undefined order. If you want the result to be ordered, you must call a sort method.
Throws:
ModelException -
Unable to execute search

find

public static java.util.Collection<Word> find(SearchCriteria criteria)
                                       throws ModelException
Finds words.

Parameters:
criteria - Search criteria.
Returns:
Collection of words, in an undefined order. If you want the result to be ordered, you must call a sort method.
Throws:
ModelException -
Unable to execute search

get

public static Word get(java.lang.String tag)
                throws ModelException
Gets a word by tag.

Parameters:
tag - Tag.
Returns:
Word, or null if none.
Throws:
ModelException -
Could not get word

sort

public static void sort(Word[] array,
                        Word.SortOption... options)
Sorts an array of words.

Parameters:
array - Array of words.
options - Sort options, or null to use the natural ordering.

sort

public static Word[] sort(java.util.Collection<Word> collection,
                          Word.SortOption... options)
Sorts a collection of words.

Parameters:
collection - Collection of words.
options - Sort options, or null to use the natural ordering.
Returns:
Sorted array of words.

getCorpus

public Corpus getCorpus()
Gets the corpus.

Returns:
The corpus that contains the word.

getWork

public Work getWork()
Gets the work.

Returns:
The work that contains the word.

getWorkPart

public WorkPart getWorkPart()
Gets the work part.

Returns:
The work part that contains the word.

getWordParts

public WordPart[] getWordParts()
Gets the word parts.

Returns:
The array of word parts for the word.

getFirstLemma

public Lemma getFirstLemma()
Gets the first lemma.

Returns:
The first lemma for the word.

getFirstPos

public Pos getFirstPos()
Gets the first part of speech.

Returns:
The first part of speech for the word.

getSpelling

public Spelling getSpelling()
Gets the spelling.

Returns:
The spelling of the word.

getStandardSpelling

public java.lang.String getStandardSpelling()
Gets the standard spelling.

Returns:
The standard spelling.

getContext

public java.lang.String getContext()
Gets the context.

Returns:
The context.

getVerse

public boolean getVerse()
Returns true if the word is verse, false if it prose.

Returns:
True if verse, false if prose.

getParatext

public boolean getParatext()
Returns true if the word is paratext, false if it normal text.

Returns:
True if paratext, false if normal text.

getPuncBefore

public java.lang.String getPuncBefore()
Gets the punctuation before.

Returns:
The string of punctuation preceding the word.

getToken

public java.lang.String getToken()
Gets the token.

Returns:
The token.

getPuncAfter

public java.lang.String getPuncAfter()
Gets the punctuation after.

Returns:
The string of punctuation following the word.

getLineBreak

public boolean getLineBreak()
Returns true if a line break follows this word.

Returns:
True if a line break follows the word.

getParBreak

public boolean getParBreak()
Returns true if a paragraph break follows this word.

Returns:
True if a paragraph break follows the word.

getNumWordParts

public int getNumWordParts()
Gets the number of word parts.

Returns:
The number of word parts for the word.

getWorkOrdinal

public long getWorkOrdinal()
Gets the work ordinal.

Returns:
The ordinal of the word within its work, starting at 0 for the first word.

getColOrdinal

public long getColOrdinal()
Gets the collocation ordinal.

Returns:
A collocation ordinal for the word.

getEndOfSentence

public boolean getEndOfSentence()
Returns true if the word is at the end of a sentence.

Returns:
True if at end of sentence.

getSentenceInWorkOrdinal

public long getSentenceInWorkOrdinal()
Gets the sentence in work ordinal.

Returns:
The ordinal of the word's sentence within its work, starting at 0 for the first sentence.

getWordInSentenceOrdinal

public long getWordInSentenceOrdinal()
Gets the word in sentence ordinal.

Returns:
The ordinal of the word within its sentence, starting at 0 for the first word.

formatAsString

public static java.lang.String formatAsString(Word... words)
Formats a sequence of words as a string.

Parameters:
words - Sequence of contiguous words.
Returns:
Word sequence formatted as a string, with punctuation, and with lime breaks represented by " / ".

equals

public boolean equals(java.lang.Object obj)
Returns true if this object equals some other object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Other object.
Returns:
True if this object equals the other object.

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code.

compareTo

public int compareTo(Word other)
Compares this instance with another.

Words are ordered first by corpus, then by work, then by work ordinal.

Specified by:
compareTo in interface java.lang.Comparable<Word>
Parameters:
other - The other instance to be compared.
Returns:
A negative integer, zero, or a positive integer as this instance is less than, equal to, or greater than the specified instance.