|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Document
Representation of an unstructured document after processing by the
DocumentService
and containing results of processing through the
annotation services. Provides access to all internal Text
objects.
Field Summary | |
---|---|
static AnnotationType<Document> |
TYPE
|
Method Summary | ||
---|---|---|
void |
addAnnotation(Text annotation)
Adds a Text to this Document . |
|
void |
addMetaData(String key,
String value)
Adds meta information about the Document using a key-value
pair. |
|
void |
addService(String serviceName)
Adds the serviceName to the list of Service s that have
been processed this Document . |
|
Collection<Text> |
getAllAnnotations()
Returns all the annotations on this Document . |
|
Map<String,Collection<String>> |
getAllMetaData()
Returns all the meta-data values attached to this Document . |
|
|
getAnnotations(AnnotationType<T> type)
Returns all the annotations on this Document that correspond
to the given AnnotationType . |
|
String |
getDocumentID()
Returns the ID of this Document . |
|
Collection<String> |
getMetaData(String key)
Returns the meta-data values for the given meta-data key. |
|
List<String> |
getServices()
Returns the names of the Service s that have processed this
Document . |
Methods inherited from interface com.languagecomputer.api.text.Text |
---|
getAnnotationType, getCongruentAnnotations, getDocument, getEndCharOffset, getIntersectingAnnotations, getRawString, getStartCharOffset, getSubAnnotations, getSuperAnnotations |
Field Detail |
---|
static final AnnotationType<Document> TYPE
Method Detail |
---|
String getDocumentID()
Document
. The document ID is a unique
identifier that can be used to retrieve the document from caches such as
the DocumentService
.
getDocumentID
in interface Text
Document
.Collection<Text> getAllAnnotations()
Document
.
Collection
of all Text
objects that are
attached to this Document
. The annotations will be in a
semi-sorted order. This means that non-intersecting objects will be
sorted by their order in the document. No guarantee will be placed on
the order of intersecting objects.<T extends Text> Collection<T> getAnnotations(AnnotationType<T> type)
Document
that correspond
to the given AnnotationType
.
T
- The Text
sub-class corresponding to the given
AnnotationType
.type
- The AnnotationType
that all returned items will match.
Collection
of objects matching the given
AnnotationType
. The annotations will be in a semi-sorted
order. This means that non-intersecting objects will be sorted
by their order in the document. No guarantee will be placed on the
order of intersecting objects.void addAnnotation(Text annotation)
Text
to this Document
.
annotation
- The Text
annotation to add.getAllAnnotations()
void addService(String serviceName)
Service
s that have
been processed this Document
. Services should not need to be
run more than once, so this allows the Document
to know which
services it has been processed by. See Service#getName
for the
convention on naming services.
serviceName
- String
name for a Service
.Service#getName
,
getServices()
List<String> getServices()
Service
s that have processed this
Document
. Services should not need to be run more than once,
so they can check this list to prevent redundant work. See
Service#getName
for the convention on naming services.
List
of Service
names that have processed this
Document
.Service#getName
,
addService(String)
void addMetaData(String key, String value)
Document
using a key-value
pair. A Document
may have multiple values for the same key.
key
- The identifier for the meta-data.value
- The value for the corresponding meta-data key.getMetaData(String)
,
getAllMetaData()
Collection<String> getMetaData(String key)
key
- The identifier for the meta-data.
Collection
of meta-data values that correspond to
the given key. Returns null
if the given
key has no values.addMetaData(String,String)
,
getAllMetaData()
Map<String,Collection<String>> getAllMetaData()
Document
.
Note that meta-data may be used to provide information to the end user or
to share information about the document between Service
s.
Consumers of meta-data should therefore be mindful of how meta-data is used
in a particular use case.
Map
of every meta-data key to its corresponding
Collection
of meta-data values.addMetaData(String,String)
,
getMetaData(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |