public class View extends Object implements Serializable, edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent>
The nodes are objects of type Constituent
and the edges are objects
of type Relation
.
This class represents a generic
Constituent
,
Relation
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected edu.illinois.cs.cogcomp.core.datastructures.QueryableList<Constituent> |
constituents
The collection of constituents
|
protected int |
endSpan
The token id of the token next to the rightmost token in this view.
|
protected edu.illinois.cs.cogcomp.core.datastructures.QueryableList<Relation> |
relations
The collection of relations in this view.
|
protected double |
score
The score of this view, which is generated by the system that annotates
this view.
|
protected int |
startSpan
The token id of the leftmost token in this view.
|
protected TextAnnotation |
textAnnotation
The TextAnnotation that is annotated by this view.
|
protected ArrayList[] |
tokensToConstituents
A inverted index from token ids to constituents in this view that cover
that token.
|
protected String |
viewGenerator
The name of the system that generates this view.
|
protected String |
viewName
The name of this view.
|
Constructor and Description |
---|
View(String viewName,
String viewGenerator,
TextAnnotation text,
double score)
Creates a view for
text called viewName which is created
using a view generator called ViewGenerator and is assigned a
score score |
Modifier and Type | Method and Description |
---|---|
void |
addConstituent(Constituent constituent)
Adds a new constituent to this view
|
void |
addRelation(Relation relation)
Adds a new relation to this view.
|
boolean |
containsConstituent(Constituent c)
Checks if this view contains a constituent
|
int |
count() |
List<Constituent> |
getConstituents()
Returns the constituents contained in this view.
|
List<Constituent> |
getConstituentsCovering(Constituent c)
Get the constituents which cover the input constituent
c . |
List<Constituent> |
getConstituentsCoveringSpan(int start,
int end) |
List<Constituent> |
getConstituentsCoveringToken(int tokenId) |
List<Constituent> |
getConstituentsCoveringTokens(Collection<Integer> tokenIds) |
int |
getEndSpan() |
protected Set<Constituent> |
getFilteredConstituents(edu.illinois.cs.cogcomp.core.transformers.Predicate<Constituent> predicate) |
List<String> |
getLabelsCovering(Constituent c)
Get the labels of the constituents covered by the input constituent
c |
List<String> |
getLabelsCoveringSpan(int start,
int end) |
List<String> |
getLabelsCoveringToken(int tokenId) |
List<String> |
getLabelsCoveringTokens(Collection<Integer> tokenIds) |
int |
getNumberOfConstituents() |
List<Relation> |
getRelations() |
View |
getRestrictedView(edu.illinois.cs.cogcomp.core.transformers.Predicate<Constituent> constituentPredicate,
edu.illinois.cs.cogcomp.core.transformers.ITransformer<View,Double> scoreTransformer) |
double |
getScore() |
int |
getStartSpan() |
TextAnnotation |
getTextAnnotation() |
View |
getViewCoveringSpan(int start,
int end,
edu.illinois.cs.cogcomp.core.transformers.ITransformer<View,Double> scoreTransformer) |
View |
getViewCoveringToken(int token,
edu.illinois.cs.cogcomp.core.transformers.ITransformer<View,Double> scoreTransformer) |
View |
getViewCoveringTokens(Collection<Integer> tokens,
edu.illinois.cs.cogcomp.core.transformers.ITransformer<View,Double> scoreTransformer) |
String |
getViewGenerator() |
String |
getViewName() |
Iterator<Constituent> |
iterator() |
edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent> |
orderBy(Comparator<Constituent> comparator) |
<S> edu.illinois.cs.cogcomp.core.datastructures.IQueryable<S> |
select(edu.illinois.cs.cogcomp.core.transformers.ITransformer<Constituent,S> transformer) |
edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent> |
unique() |
edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent> |
where(edu.illinois.cs.cogcomp.core.transformers.Predicate<Constituent> condition) |
protected final String viewName
ViewNames
.protected final double score
protected final TextAnnotation textAnnotation
protected final edu.illinois.cs.cogcomp.core.datastructures.QueryableList<Constituent> constituents
protected final edu.illinois.cs.cogcomp.core.datastructures.QueryableList<Relation> relations
protected int startSpan
protected int endSpan
protected final String viewGenerator
protected final ArrayList[] tokensToConstituents
public View(String viewName, String viewGenerator, TextAnnotation text, double score)
text
called viewName
which is created
using a view generator called ViewGenerator
and is assigned a
score score
viewName
- The name of this viewviewGenerator
- The source of this viewtext
- The text annotation that this view annotatesscore
- The score of this viewpublic void addConstituent(Constituent constituent)
constituent
- The new constituent to be added.public void addRelation(Relation relation)
relation
- The relation to be addedpublic boolean containsConstituent(Constituent c)
c
- The constituent, whose containership needs to be checked.true
if this view contains the constituentpublic List<Constituent> getConstituents()
public List<Constituent> getConstituentsCovering(Constituent c)
c
.c
- A constituent, not necessarily of this text annotation.public List<String> getLabelsCovering(Constituent c)
c
c
- A constituent, not necessarily of this text annotation.public List<String> getLabelsCoveringTokens(Collection<Integer> tokenIds)
public List<Constituent> getConstituentsCoveringSpan(int start, int end)
start
- end
- public List<Constituent> getConstituentsCoveringTokens(Collection<Integer> tokenIds)
public List<Constituent> getConstituentsCoveringToken(int tokenId)
public int getEndSpan()
protected Set<Constituent> getFilteredConstituents(edu.illinois.cs.cogcomp.core.transformers.Predicate<Constituent> predicate)
public int getNumberOfConstituents()
public View getRestrictedView(edu.illinois.cs.cogcomp.core.transformers.Predicate<Constituent> constituentPredicate, edu.illinois.cs.cogcomp.core.transformers.ITransformer<View,Double> scoreTransformer)
public double getScore()
public int getStartSpan()
public TextAnnotation getTextAnnotation()
public View getViewCoveringSpan(int start, int end, edu.illinois.cs.cogcomp.core.transformers.ITransformer<View,Double> scoreTransformer)
public View getViewCoveringToken(int token, edu.illinois.cs.cogcomp.core.transformers.ITransformer<View,Double> scoreTransformer)
public View getViewCoveringTokens(Collection<Integer> tokens, edu.illinois.cs.cogcomp.core.transformers.ITransformer<View,Double> scoreTransformer)
public String getViewName()
ViewNames
.public String getViewGenerator()
public edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent> orderBy(Comparator<Constituent> comparator)
orderBy
in interface edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent>
public <S> edu.illinois.cs.cogcomp.core.datastructures.IQueryable<S> select(edu.illinois.cs.cogcomp.core.transformers.ITransformer<Constituent,S> transformer)
select
in interface edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent>
public edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent> unique()
unique
in interface edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent>
public edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent> where(edu.illinois.cs.cogcomp.core.transformers.Predicate<Constituent> condition)
where
in interface edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent>
public Iterator<Constituent> iterator()
iterator
in interface Iterable<Constituent>
public int count()
count
in interface edu.illinois.cs.cogcomp.core.datastructures.IQueryable<Constituent>
Copyright © 2015. All rights reserved.