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) |
SpanLabelView(String viewName,
TextAnnotation text)
Create a new SpanLabelView with default
View.viewGenerator and View.score . |
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, getConstituentsCoveringCharSpan, getConstituentsCoveringSpan, getConstituentsCoveringToken, getConstituentsCoveringTokens, getConstituentsOverlappingCharSpan, getConstituentsWithSpan, getEndSpan, getFilteredConstituents, getLabelsCovering, getLabelsCoveringSpan, getLabelsCoveringToken, getLabelsCoveringTokens, getNumberOfConstituents, getRelations, getRestrictedView, getScore, getStartSpan, getTextAnnotation, getViewCoveringSpan, getViewCoveringToken, getViewCoveringTokens, getViewGenerator, getViewName, iterator, orderBy, removeAllConsituents, removeAllRelations, removeAttributes, removeConstituent, removeRelation, select, unique, where
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public SpanLabelView(String viewName, TextAnnotation text)
View.viewGenerator
and View.score
.viewName
- the name of the viewtext
- the TextAnnotation to augmentpublic SpanLabelView(String viewName, String viewGenerator, TextAnnotation text, double score)
public SpanLabelView(String viewName, String viewGenerator, TextAnnotation text, double score, boolean 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 © 2017. All rights reserved.