|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.washington.cs.knowitall.sequence.SimpleLayeredSequence
edu.washington.cs.knowitall.sequence.BIOLayeredSequence
edu.washington.cs.knowitall.nlp.ChunkedSentence
edu.washington.cs.knowitall.Sentence
public class Sentence
A representation of a sentence. This class extends ChunkedSentence to support types, lemmas, and various serialization methods.
| Field Summary | |
|---|---|
Long |
id
|
String |
originalText
|
protected List<com.google.common.collect.TreeMultimap<String,Type>> |
typeLookup
|
| Fields inherited from class edu.washington.cs.knowitall.nlp.ChunkedSentence |
|---|
NP_LAYER, POS_LAYER, TOKEN_LAYER |
| Constructor Summary | |
|---|---|
Sentence(edu.washington.cs.knowitall.nlp.ChunkedSentence chunked,
String originalText)
|
|
Sentence(edu.washington.cs.knowitall.nlp.ChunkedSentence chunked,
String originalText,
Iterable<String> norms)
|
|
Sentence(Long id,
String originalText,
List<String> tokens,
Iterable<String> norms,
List<String> posTags,
List<String> npChunkTags)
|
|
Sentence(Long id,
String originalText,
String[] tokens,
String[] norms,
String[] posTags,
String[] npChunkTags)
|
|
Sentence(String originalText,
List<String> tokens,
Iterable<String> norms,
List<String> posTags,
List<String> chunkTags)
|
|
Sentence(String originalText,
String[] tokens,
String[] norms,
String[] posTags,
String[] chunkTags)
|
|
| Method Summary | |
|---|---|
void |
addExtraction(Iterable<edu.washington.cs.knowitall.nlp.extraction.ChunkedBinaryExtraction> extractions)
Add multiple extractions to this sentence. |
void |
addExtraction(RelationExtraction extraction)
Add an extraction to this sentence. |
void |
addExtractions(Iterable<RelationExtraction> extractions)
Add multiple extractions to this sentence. |
static String |
convertGroup(edu.washington.cs.knowitall.commonlib.regex.Match.Group<Token> group)
|
boolean |
equals(Object that)
|
List<RelationExtraction> |
extractions()
The extractions in this sentence. |
static Iterable<RelationExtraction> |
extractions(Iterable<Sentence> sentences)
|
static List<Sentence> |
fromDocument(org.jdom.Document document)
Deserialize sentence from an XML document. |
static Sentence |
fromXmlElement(org.jdom.Element e)
|
Long |
getId()
|
List<String> |
getLemmas()
The lemmas of this sentence. |
List<String> |
getLemmas(edu.washington.cs.knowitall.commonlib.Range range)
The lemmas of this sentence, constraint to the specified range. |
edu.washington.cs.knowitall.commonlib.Range |
getRange()
|
edu.washington.cs.knowitall.commonlib.Range |
getRange(String string)
|
List<Type> |
getTypes()
|
int |
hashCode()
|
static edu.washington.cs.knowitall.commonlib.regex.RegularExpression<Token> |
makeRegex(String regex)
This class compiles regular expressions over the tokens in a sentence into an NFA. |
void |
tag(Iterable<Type> types)
Add a collection of types to this sentence. |
void |
tag(Type type)
Add a type to this sentence. |
String |
toString()
|
org.jdom.Element |
toXmlElement()
|
List<Type> |
types()
The types associated with this sentence. |
List<Token> |
zip()
Represent this sentence as a list of tokens (instead of an object that contains separate array for each field). |
List<Token> |
zip(edu.washington.cs.knowitall.commonlib.Range range)
Represent a range in this sentence as a list of tokens. |
| Methods inherited from class edu.washington.cs.knowitall.nlp.ChunkedSentence |
|---|
clone, getChunkTag, getChunkTags, getChunkTags, getChunkTags, getChunkTagsAsString, getNpChunkRanges, getPosTag, getPosTags, getPosTags, getPosTags, getPosTagsAsString, getPosTagsAsString, getPosTagsAsString, getSubSequence, getSubSequence, getToken, getTokenRange, getTokens, getTokens, getTokens, getTokensAsString, getTokensAsString, getTokensAsString, toOpenNlpFormat |
| Methods inherited from class edu.washington.cs.knowitall.sequence.BIOLayeredSequence |
|---|
addSpanLayer, addSpanLayerRanges, getSpans, getSpans, getSubSequence, getSubSequence, isSpanLayer |
| Methods inherited from class edu.washington.cs.knowitall.sequence.SimpleLayeredSequence |
|---|
addLayer, addLayer, addLayer, get, getLayer, getLayerAsString, getLayerAsString, getLayerAsString, getLayerNames, getLength, getNumLayers, hasLayer |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.washington.cs.knowitall.TokenSequence |
|---|
getChunkTags, getPosTags, getTokens, getTokensAsString |
| Field Detail |
|---|
public final Long id
public final String originalText
protected final List<com.google.common.collect.TreeMultimap<String,Type>> typeLookup
| Constructor Detail |
|---|
public Sentence(edu.washington.cs.knowitall.nlp.ChunkedSentence chunked,
String originalText,
Iterable<String> norms)
throws edu.washington.cs.knowitall.sequence.SequenceException
edu.washington.cs.knowitall.sequence.SequenceException
public Sentence(edu.washington.cs.knowitall.nlp.ChunkedSentence chunked,
String originalText)
public Sentence(String originalText,
String[] tokens,
String[] norms,
String[] posTags,
String[] chunkTags)
throws edu.washington.cs.knowitall.sequence.SequenceException
edu.washington.cs.knowitall.sequence.SequenceException
public Sentence(String originalText,
List<String> tokens,
Iterable<String> norms,
List<String> posTags,
List<String> chunkTags)
throws edu.washington.cs.knowitall.sequence.SequenceException
edu.washington.cs.knowitall.sequence.SequenceException
public Sentence(Long id,
String originalText,
String[] tokens,
String[] norms,
String[] posTags,
String[] npChunkTags)
throws edu.washington.cs.knowitall.sequence.SequenceException
edu.washington.cs.knowitall.sequence.SequenceException
public Sentence(Long id,
String originalText,
List<String> tokens,
Iterable<String> norms,
List<String> posTags,
List<String> npChunkTags)
| Method Detail |
|---|
public static List<Sentence> fromDocument(org.jdom.Document document)
document - document to deserialize
public String toString()
toString in class edu.washington.cs.knowitall.nlp.ChunkedSentencepublic boolean equals(Object that)
equals in class edu.washington.cs.knowitall.sequence.SimpleLayeredSequencepublic int hashCode()
hashCode in class edu.washington.cs.knowitall.sequence.SimpleLayeredSequencepublic List<Token> zip()
The list is cached for speed.
zip in interface TokenSequencepublic List<Token> zip(edu.washington.cs.knowitall.commonlib.Range range)
range -
public edu.washington.cs.knowitall.commonlib.Range getRange(String string)
public List<Type> types()
public void tag(Iterable<Type> types)
types - public void tag(Type type)
type - public edu.washington.cs.knowitall.commonlib.Range getRange()
public List<String> getLemmas()
getLemmas in interface TokenSequencepublic List<String> getLemmas(edu.washington.cs.knowitall.commonlib.Range range)
range -
public void addExtraction(RelationExtraction extraction)
extraction - public void addExtractions(Iterable<RelationExtraction> extractions)
extractions - public void addExtraction(Iterable<edu.washington.cs.knowitall.nlp.extraction.ChunkedBinaryExtraction> extractions)
RelationExtraction.
extractions - public List<RelationExtraction> extractions()
public static Sentence fromXmlElement(org.jdom.Element e)
public org.jdom.Element toXmlElement()
toXmlElement in interface XmlSerializablepublic static Iterable<RelationExtraction> extractions(Iterable<Sentence> sentences)
public static edu.washington.cs.knowitall.commonlib.regex.RegularExpression<Token> makeRegex(String regex)
<pos="NNPS?"> is equivalent to "<pos="NNP" | pos="NNPS"> and
(?:<pos="NNP"> | <pos="NNPS">).
Here are some equivalent examples:
<pos="JJ">* <pos="NNP.">+
<pos="JJ">* <pos="NNPS?">+
<pos="JJ">* <pos="NNP" | pos="NNPS">+
<pos="JJ">* (?:<pos="NNP"> | <pos="NNPS">)+
The Regular Expressions support named groups (
regex -
public static String convertGroup(edu.washington.cs.knowitall.commonlib.regex.Match.Group<Token> group)
public Long getId()
public List<Type> getTypes()
getTypes in interface TokenSequence
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||