public class ConcordanceSentence extends java.util.AbstractList<IConcordanceToken> implements IConcordanceSentence, java.util.RandomAccess
ISemcorSentence
This class requires JSemcor to be on the classpath.
| Modifier and Type | Field and Description |
|---|---|
static java.util.regex.Pattern |
taggedSemcorSentencePattern
A compiled regular expression pattern that captures the string
representation of a Semcor sentence.
|
| Constructor and Description |
|---|
ConcordanceSentence(edu.mit.jsemcor.element.IContextID cid,
int sentNum,
java.util.List<? extends IConcordanceToken> tokens)
Constructs a new semcor sentence from the list of tokens.
|
ConcordanceSentence(edu.mit.jsemcor.element.IContextID cid,
edu.mit.jsemcor.element.ISentence sent)
Constructs a new semcor sentence from the specified context id and
JSemcor sentence object.
|
| Modifier and Type | Method and Description |
|---|---|
IConcordanceToken |
get(int index) |
edu.mit.jsemcor.element.IContextID |
getContextID()
Returns the context id from which this sentence was drawn.
|
java.lang.String |
getID()
Returns an ID string that uniquely identifies this object or object type.
|
int |
getSentenceNumber()
Returns the sentence number of this sentence in the specified Semcor
context.
|
static java.lang.String |
makeID(edu.mit.jsemcor.element.IContextID cid,
int sentNum)
Returns a string ID constructed from the given
IContextID and
sentence number. |
static ConcordanceSentence |
parse(java.lang.String toString)
Parses a string formed from the a string of the form
|
int |
size() |
java.lang.String |
toString() |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final java.util.regex.Pattern taggedSemcorSentencePattern
public ConcordanceSentence(edu.mit.jsemcor.element.IContextID cid,
edu.mit.jsemcor.element.ISentence sent)
cid - the context id for the JSemcor sentence; may not be
nullsent - the JSemcor sentence; may not be nulljava.lang.NullPointerException - if either argument is nullpublic ConcordanceSentence(edu.mit.jsemcor.element.IContextID cid,
int sentNum,
java.util.List<? extends IConcordanceToken> tokens)
cid - the context id for the JSemcor sentence; may not be
nullsentNum - the sentence number; must be positivetokens - the list of tokens that will make up this list, may not be
null or emptyjava.lang.NullPointerException - if the context id, or the list of source tokens is
null or contains nulljava.lang.IllegalArgumentException - if the sentence number is non-positive, or the list is emptypublic java.lang.String getID()
IHasIDnull.public edu.mit.jsemcor.element.IContextID getContextID()
IConcordanceSentencenull.getContextID in interface IConcordanceSentencenull context id from which this sentence was
drawn.public int getSentenceNumber()
IConcordanceSentencegetSentenceNumber in interface IConcordanceSentencepublic IConcordanceToken get(int index)
get in interface java.util.List<IConcordanceToken>get in class java.util.AbstractList<IConcordanceToken>public int size()
size in interface java.util.Collection<IConcordanceToken>size in interface java.util.List<IConcordanceToken>size in class java.util.AbstractCollection<IConcordanceToken>public java.lang.String toString()
toString in class java.util.AbstractCollection<IConcordanceToken>public static ConcordanceSentence parse(java.lang.String toString)
concordanceName/contextID/sentNumber [tok_tag_stems_num_part]+into a
ConcordanceSentence instance.toString - the string representing the tagged semcor sentence.java.lang.NullPointerException - if the specified string is nulljava.lang.IllegalArgumentException - if the specified string does not conform to the expected
formatpublic static java.lang.String makeID(edu.mit.jsemcor.element.IContextID cid,
int sentNum)
IContextID and
sentence number. For the Semcor corpus, this ID has the form:
brown1/br-a01/1
cid - the context idsentNum - the sentence numberCopyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.