|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cmu.minorthird.text.NestedTextLabels
public class NestedTextLabels
A TextLabels which is defined by two TextLabels's.
Operationally, new assertions are passed to the 'outer' TextLabels. Assertions about property definitions from the outer TextLabels shadow assertions made in the inner TextLabels, and other assertions are added to assertions in the inner TextLabels.
Pragmatically, this means that if you create a NestedTextLabels from outerLabels and innerLabels, where outerLabels is empty, the NestedTextLabels will initially look like innerLabels. But if you modify it, innerLabels will not be changed, so you can at any point easily revert to the old innerLabels TextLabels.
Constructor Summary | |
---|---|
NestedTextLabels(MonotonicTextLabels outer,
TextLabels inner)
Create a NestedTextLabels. |
|
NestedTextLabels(TextLabels inner)
Create a NestedTextLabels with an empty outer labeling. |
Method Summary | |
---|---|
void |
addToType(Span span,
java.lang.String type)
Assert that a span has a given type. |
void |
addToType(Span span,
java.lang.String type,
Details details)
Assert that a span has a given type, and associate that assertion with some detailed information. |
void |
annotateWith(java.lang.String annotationType,
java.lang.String fileToLoad)
Annotate labels with annotator named fileToLoad |
java.util.Iterator<Span> |
closureIterator(java.lang.String type)
Returns the spans s for in the given type is 'closed'. |
java.util.Iterator<Span> |
closureIterator(java.lang.String type,
java.lang.String documentId)
Returns the spans S inside the given document in which the given type is 'closed'. |
void |
declareType(java.lang.String type)
Declare a new type, without asserting any spans as members. |
void |
defineDictionary(java.lang.String dictName,
java.util.List<java.lang.String> fileNames,
boolean ignoreCase)
Associate a dictionary from this file |
void |
defineDictionary(java.lang.String dictName,
java.util.Set<java.lang.String> dict)
Associate a dictionary with this labeling. |
void |
defineTrie(java.util.List<java.lang.String> phraseList)
Define a trie |
AnnotatorLoader |
getAnnotatorLoader()
Get the current AnnotatorLoader. |
Details |
getDetails(Span span,
java.lang.String type)
Retrieve additional information associated with an assertion 'span S has type T'. |
java.lang.String |
getProperty(Span span,
java.lang.String prop)
Get the value of the named property which has been associated with this Span. |
java.lang.String |
getProperty(Token token,
java.lang.String prop)
Get the property value associated with this TextToken. |
java.util.Set<java.lang.String> |
getSpanProperties()
Get a set of all previously-defined properties. |
java.util.Iterator<Span> |
getSpansWithProperty(java.lang.String prop)
Find all spans that have a non-null value for this property. |
java.util.Iterator<Span> |
getSpansWithProperty(java.lang.String prop,
java.lang.String id)
Find all spans in the named document that have a non-null value for this property. |
TextBase |
getTextBase()
Returns the TextBase which is annotated by this TextLabels, or null if that isn't set yet. |
java.util.Set<java.lang.String> |
getTokenProperties()
Get a set of all properties. |
Trie |
getTrie()
Return a trie if defined |
java.util.Set<java.lang.String> |
getTypes()
Return a set of all type names. |
java.util.Set<Span> |
getTypeSet(java.lang.String type,
java.lang.String documentId)
Return the Set of all Spans with a given type in a given document |
boolean |
hasDictionary(java.lang.String dictionary)
|
boolean |
hasType(Span span,
java.lang.String type)
Query if a span has a given type. |
boolean |
inDict(Token token,
java.lang.String dictionary)
Returns true if the value of the Token is in the named dictionary. |
java.util.Iterator<Span> |
instanceIterator(java.lang.String type)
Get all instances of a given type. |
java.util.Iterator<Span> |
instanceIterator(java.lang.String type,
java.lang.String documentId)
Get all instances of a given type. |
boolean |
isAnnotatedBy(java.lang.String s)
See if the TextLabels contains a particular type of annotation |
boolean |
isType(java.lang.String type)
True if the given string names a type. |
void |
require(java.lang.String annotationType,
java.lang.String fileToLoad)
Ensure that this TextLabels contains a particular type of annotation. |
void |
require(java.lang.String annotationType,
java.lang.String fileToLoad,
AnnotatorLoader loader)
Ensure that this TextLabels contains a particular type of annotation. |
void |
setAnnotatedBy(java.lang.String s)
Record that this TextLabels was annotated with some type of annotation. |
void |
setAnnotatorLoader(AnnotatorLoader newLoader)
Specify the AnnotatorLoader used to find Annotations when a 'require' call is made. |
void |
setProperty(Span span,
java.lang.String prop,
java.lang.String value)
Assert that Span span has the given value of the given property |
void |
setProperty(Span span,
java.lang.String prop,
java.lang.String value,
Details details)
Assert that Span span has the given value of the given property, and associate that with some detailed information |
void |
setProperty(Token token,
java.lang.String prop,
java.lang.String value)
Assert that TextToken textToken has the given value of the given property. |
void |
setProperty(Token token,
java.lang.String prop,
java.lang.String value,
Details details)
Assert that a token has a given property value, and associate that with some detailed information. |
void |
shadowProperty(java.lang.String prop)
Effectively, remove the property from this TextLabels. |
java.lang.String |
showTokenProp(TextBase base,
java.lang.String prop)
For debugging. |
Viewer |
toGUI()
Create a view of this object |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NestedTextLabels(MonotonicTextLabels outer, TextLabels inner)
public NestedTextLabels(TextLabels inner)
Method Detail |
---|
public TextBase getTextBase()
TextLabels
getTextBase
in interface TextLabels
public boolean hasDictionary(java.lang.String dictionary)
hasDictionary
in interface TextLabels
dictionary
- String name of the dictionary
public boolean isAnnotatedBy(java.lang.String s)
TextLabels
isAnnotatedBy
in interface TextLabels
public void setAnnotatedBy(java.lang.String s)
MonotonicTextLabels
setAnnotatedBy
in interface MonotonicTextLabels
public void setAnnotatorLoader(AnnotatorLoader newLoader)
MonotonicTextLabels
setAnnotatorLoader
in interface MonotonicTextLabels
public AnnotatorLoader getAnnotatorLoader()
MonotonicTextLabels
getAnnotatorLoader
in interface MonotonicTextLabels
public void defineDictionary(java.lang.String dictName, java.util.Set<java.lang.String> dict)
MonotonicTextLabels
defineDictionary
in interface MonotonicTextLabels
public void defineDictionary(java.lang.String dictName, java.util.List<java.lang.String> fileNames, boolean ignoreCase)
defineDictionary
in interface MonotonicTextLabels
public Trie getTrie()
getTrie
in interface MonotonicTextLabels
public void defineTrie(java.util.List<java.lang.String> phraseList)
defineTrie
in interface MonotonicTextLabels
public boolean inDict(Token token, java.lang.String dictionary)
TextLabels
inDict
in interface TextLabels
public void shadowProperty(java.lang.String prop)
public void setProperty(Token token, java.lang.String prop, java.lang.String value)
MonotonicTextLabels
setProperty
in interface MonotonicTextLabels
public void setProperty(Token token, java.lang.String prop, java.lang.String value, Details details)
MonotonicTextLabels
setProperty
in interface MonotonicTextLabels
public java.lang.String getProperty(Token token, java.lang.String prop)
TextLabels
getProperty
in interface TextLabels
public java.util.Iterator<Span> getSpansWithProperty(java.lang.String prop)
TextLabels
getSpansWithProperty
in interface TextLabels
public java.util.Iterator<Span> getSpansWithProperty(java.lang.String prop, java.lang.String id)
TextLabels
getSpansWithProperty
in interface TextLabels
public java.util.Set<java.lang.String> getTokenProperties()
TextLabels
getTokenProperties
in interface TextLabels
public void setProperty(Span span, java.lang.String prop, java.lang.String value)
MonotonicTextLabels
setProperty
in interface MonotonicTextLabels
public void setProperty(Span span, java.lang.String prop, java.lang.String value, Details details)
MonotonicTextLabels
setProperty
in interface MonotonicTextLabels
public java.lang.String getProperty(Span span, java.lang.String prop)
TextLabels
getProperty
in interface TextLabels
public java.util.Set<java.lang.String> getSpanProperties()
TextLabels
getSpanProperties
in interface TextLabels
public void addToType(Span span, java.lang.String type)
MonotonicTextLabels
addToType
in interface MonotonicTextLabels
public void addToType(Span span, java.lang.String type, Details details)
MonotonicTextLabels
addToType
in interface MonotonicTextLabels
public boolean hasType(Span span, java.lang.String type)
TextLabels
hasType
in interface TextLabels
public java.util.Iterator<Span> instanceIterator(java.lang.String type)
TextLabels
instanceIterator
in interface TextLabels
public java.util.Iterator<Span> instanceIterator(java.lang.String type, java.lang.String documentId)
TextLabels
instanceIterator
in interface TextLabels
public java.util.Iterator<Span> closureIterator(java.lang.String type)
TextLabels
closureIterator
in interface TextLabels
public java.util.Iterator<Span> closureIterator(java.lang.String type, java.lang.String documentId)
TextLabels
closureIterator
in interface TextLabels
public java.util.Set<java.lang.String> getTypes()
TextLabels
getTypes
in interface TextLabels
public java.util.Set<Span> getTypeSet(java.lang.String type, java.lang.String documentId)
TextLabels
getTypeSet
in interface TextLabels
public boolean isType(java.lang.String type)
TextLabels
isType
in interface TextLabels
public void declareType(java.lang.String type)
MonotonicTextLabels
declareType
in interface MonotonicTextLabels
public Details getDetails(Span span, java.lang.String type)
TextLabels
getDetails
in interface TextLabels
public void require(java.lang.String annotationType, java.lang.String fileToLoad)
TextLabels
require
in interface TextLabels
public void require(java.lang.String annotationType, java.lang.String fileToLoad, AnnotatorLoader loader)
TextLabels
require
in interface TextLabels
public void annotateWith(java.lang.String annotationType, java.lang.String fileToLoad)
annotateWith
in interface TextLabels
public java.lang.String showTokenProp(TextBase base, java.lang.String prop)
TextLabels
showTokenProp
in interface TextLabels
public Viewer toGUI()
Visible
toGUI
in interface Visible
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |