|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.washington.cs.knowitall.extractor.Extractor<S,T>
S - the source typeT - the target extraction typepublic abstract class Extractor<S,T>
An abstract class that defines the basic behavior of an extractor. An
Extractor<S,T> object extracts objects of type T from a
source object of type S. Candidate extractions are first obtained by
calling the extractCandidates(Object) method, which returns
an Iterable object over extractions of type T. These
extractions are passed through a list of Mapper<T> objects,
each of which can filter or modify the extractions.
Other objects can use an Extractor<S,T> object by calling the
extract(Object)extract(S source) object, which returns an
Iterable object of extractions after the Mappers have
been applied.
Mapper objects can be added to the list of Mappers by calling
the addMapper(Mapper) method. This will add a mapper to
the end of the list (i.e. it is the last one to be applied to the
extractions).
Subclasses extending Extractor<S,T> must implement the abstract
extractCandidates(Object) method.
As an example, this class can be used to implement a class for extracting
String sentences from a String block of text. Mapper objects can be
added to filter the sentences by length, or remove brackets from the
sentences.
| Constructor Summary | |
|---|---|
Extractor()
Constructs a new extractor with no mappers. |
|
| Method Summary | ||
|---|---|---|
void |
addMapper(Mapper<T> mapper)
Adds a mapper to the end of the list of mappers. |
|
static
|
compose(Extractor<R,S> rsExtractor,
Extractor<S,T> stExtractor)
Composes a R->S extractor with a S->T extractor to create
a R->T extractor. |
|
Iterable<T> |
extract(S source)
|
|
protected abstract Iterable<T> |
extractCandidates(S source)
Extracts candidate extractions from the given source object. |
|
MapperList<T> |
getMappers()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Extractor()
| Method Detail |
|---|
public MapperList<T> getMappers()
public void addMapper(Mapper<T> mapper)
mapper - the mapper to add.
protected abstract Iterable<T> extractCandidates(S source)
throws ExtractorException
extract(Object), the this method is
used to generate a set of candidate extractions, which are then passed
through each mapper object attached to the extractor.
source - the source to extract from.
ExtractorException - if unable to extract
public Iterable<T> extract(S source)
throws ExtractorException
source - the source object to extract from.
ExtractorException - if unable to extract
public static <R,S,T> Extractor<R,T> compose(Extractor<R,S> rsExtractor,
Extractor<S,T> stExtractor)
R->S extractor with a S->T extractor to create
a R->T extractor.
R - S - T - rsExtractor - stExtractor -
R and returning
objects of type T
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||