edu.washington.cs.knowitall.nlp.extraction
Class ChunkedExtraction
java.lang.Object
edu.washington.cs.knowitall.nlp.extraction.ChunkedExtraction
- All Implemented Interfaces:
- ChunkedSource, Extraction<ChunkedSentence>, PosTagged, Tokenized
- Direct Known Subclasses:
- ChunkedArgumentExtraction, OrdinalPhraseExtraction
public class ChunkedExtraction
- extends java.lang.Object
- implements PosTagged, Extraction<ChunkedSentence>, ChunkedSource
An Extraction
object that represents a contiguous subsequence of a NpChunkedSentence
object. A NpChunkedExtraction
has a reference to the NpChunkedSentence
object sent
and a Range
object range
. range
is the subsequence of sent
that
this extraction represents.
- Author:
- afader
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
ChunkedExtraction
public ChunkedExtraction(ChunkedSentence sent,
Range range)
- Constructs a new
NpChunkedExtraction
object representing range
in
the sentence sent
. range
must be a subset of [0, sent.getLength()
).
- Parameters:
sent
- the source sentence.range
- the subsequence of sent
that this extraction will represent.
getStart
public int getStart()
- Returns:
- the start index of the extraction.
getRange
public Range getRange()
- Returns:
- the
Range
object that represents the
subsequence of the source sentence.
getSource
public ChunkedSentence getSource()
- Specified by:
getSource
in interface Extraction<ChunkedSentence>
- Returns:
- the source of this extraction.
getSentence
public ChunkedSentence getSentence()
- Specified by:
getSentence
in interface ChunkedSource
- Returns:
- the source sentence of this extraction.
getLength
public int getLength()
- Specified by:
getLength
in interface Tokenized
getTokens
public java.util.List<java.lang.String> getTokens()
- Specified by:
getTokens
in interface Tokenized
- Returns:
- the tokens of this extraction.
getTokens
public java.util.List<java.lang.String> getTokens(int start,
int length)
- Specified by:
getTokens
in interface Tokenized
getTokensAsString
public java.lang.String getTokensAsString()
- Returns:
- the tokens joined by space.
getTokens
public java.util.List<java.lang.String> getTokens(Range range)
- Specified by:
getTokens
in interface Tokenized
getPosTags
public java.util.List<java.lang.String> getPosTags()
- Specified by:
getPosTags
in interface PosTagged
- Returns:
- an iterable object over the POS tags.
getPosTags
public java.util.List<java.lang.String> getPosTags(int start,
int length)
- Specified by:
getPosTags
in interface PosTagged
- Returns:
- an iterable over
length
POS tags starting at start
isAdjacentOrOverlaps
public boolean isAdjacentOrOverlaps(ChunkedExtraction extr)
- Parameters:
extr
-
- Returns:
- true if this extraction is adjacent to or overlaps with
extr in this sentence.
overlapsWith
public boolean overlapsWith(ChunkedExtraction extr)
- Parameters:
extr
-
- Returns:
- true if this extraction overlaps with extr in this sentence.
getPosTags
public java.util.List<java.lang.String> getPosTags(Range range)
- Specified by:
getPosTags
in interface PosTagged
- Returns:
- an iterable over the POS tags at the indexes given by
range
.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
- Returns:
- the tokens of this extraction, joined by a space.
getPair
public Pair<java.lang.String,java.lang.String> getPair(int i)
- Specified by:
getPair
in interface PosTagged
- Returns:
- a (token, POS tag) pair at the given index
i
.
getToken
public java.lang.String getToken(int i)
- Specified by:
getToken
in interface Tokenized
getPosTag
public java.lang.String getPosTag(int i)
- Specified by:
getPosTag
in interface PosTagged
- Returns:
- the POS tag at index
i
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object