public class SpanLabelView extends View
Consituent
. In this view, there will be no Relation
s between
the constituents.
This class is best suited for views like Shallow parse and Named Entities.
constituents, endSpan, relations, score, startSpan, textAnnotation, tokensToConstituents, viewGenerator, viewName
Constructor and Description |
---|
SpanLabelView(String viewName,
String viewGenerator,
TextAnnotation text,
double score)
Create a new SpanLabelView
|
SpanLabelView(String viewName,
String viewGenerator,
TextAnnotation text,
double score,
boolean allowOverlappingSpans) |
Modifier and Type | Method and Description |
---|---|
void |
addConstituent(Constituent constituent)
Adds a new constituent to this view
|
Constituent |
addSpanLabel(int start,
int end,
String label,
double score)
Adds a new span to this view with a given label and score and returns the
newly created constituent.
|
String |
getLabel(int tokenId) |
List<Constituent> |
getSpanLabels(int start,
int end) |
String |
toString() |
addRelation, containsConstituent, count, getConstituents, getConstituentsCovering, getConstituentsCoveringSpan, getConstituentsCoveringToken, getConstituentsCoveringTokens, getEndSpan, getFilteredConstituents, getLabelsCovering, getLabelsCoveringSpan, getLabelsCoveringToken, getLabelsCoveringTokens, getNumberOfConstituents, getRelations, getRestrictedView, getScore, getStartSpan, getTextAnnotation, getViewCoveringSpan, getViewCoveringToken, getViewCoveringTokens, getViewGenerator, getViewName, iterator, orderBy, select, unique, where
public SpanLabelView(String viewName, String viewGenerator, TextAnnotation text, double score)
id
- viewName
- text
- score
- public SpanLabelView(String viewName, String viewGenerator, TextAnnotation text, double score, boolean allowOverlappingSpans)
id
- viewName
- text
- score
- allowOverlappingSpans
- public void addConstituent(Constituent constituent)
View
addConstituent
in class View
constituent
- The new constituent to be added.public Constituent addSpanLabel(int start, int end, String label, double score)
If this SpanLabelView
was defined not to accept overlapping spans
(in the constructor), then this function will throw an
IllegalArgumentException
when an attempt is made to label an
already existing span.
start
- the start of the spanend
- the end of the spanlabel
- the label of the spanscore
- the score assigned to this labelpublic String getLabel(int tokenId)
public List<Constituent> getSpanLabels(int start, int end)
Copyright © 2015. All rights reserved.