edu.cmu.minorthird.text.learn.experiments
Class SubTextLabels

java.lang.Object
  extended by edu.cmu.minorthird.text.learn.experiments.SubTextLabels
All Implemented Interfaces:
TextLabels, Visible
Direct Known Subclasses:
MonotonicSubTextLabels

public class SubTextLabels
extends java.lang.Object
implements TextLabels, Visible

A subset of another TextLabels.

Author:
William Cohen

Field Summary
protected  TextLabels labels
           
protected  SubTextBase subBase
           
 
Constructor Summary
SubTextLabels(SubTextBase subBase, TextLabels labels)
           
 
Method Summary
 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'.
 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.
 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 dict)
          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)
           
 void setProperty(Span span, java.lang.String prop, java.lang.String value)
          Assert that Span span has the given value of the given property
 java.lang.String showTokenProp(TextBase base, java.lang.String prop)
          For debugging.
 Viewer toGUI()
          Create a view of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subBase

protected SubTextBase subBase

labels

protected TextLabels labels
Constructor Detail

SubTextLabels

public SubTextLabels(SubTextBase subBase,
                     TextLabels labels)
Method Detail

isAnnotatedBy

public boolean isAnnotatedBy(java.lang.String s)
Description copied from interface: TextLabels
See if the TextLabels contains a particular type of annotation

Specified by:
isAnnotatedBy in interface TextLabels

setAnnotatedBy

public void setAnnotatedBy(java.lang.String s)

getTextBase

public TextBase getTextBase()
Description copied from interface: TextLabels
Returns the TextBase which is annotated by this TextLabels, or null if that isn't set yet.

Specified by:
getTextBase in interface TextLabels

hasDictionary

public boolean hasDictionary(java.lang.String dictionary)
Specified by:
hasDictionary in interface TextLabels
Parameters:
dictionary - String name of the dictionary
Returns:
true if the dictionary is defined for these labels

inDict

public boolean inDict(Token token,
                      java.lang.String dict)
Description copied from interface: TextLabels
Returns true if the value of the Token is in the named dictionary.

Specified by:
inDict in interface TextLabels

getProperty

public java.lang.String getProperty(Token token,
                                    java.lang.String prop)
Description copied from interface: TextLabels
Get the property value associated with this TextToken.

Specified by:
getProperty in interface TextLabels

getTokenProperties

public java.util.Set<java.lang.String> getTokenProperties()
Description copied from interface: TextLabels
Get a set of all properties.

Specified by:
getTokenProperties in interface TextLabels

getProperty

public java.lang.String getProperty(Span span,
                                    java.lang.String prop)
Description copied from interface: TextLabels
Get the value of the named property which has been associated with this Span.

Specified by:
getProperty in interface TextLabels

getSpanProperties

public java.util.Set<java.lang.String> getSpanProperties()
Description copied from interface: TextLabels
Get a set of all previously-defined properties.

Specified by:
getSpanProperties in interface TextLabels

getSpansWithProperty

public java.util.Iterator<Span> getSpansWithProperty(java.lang.String prop)
Description copied from interface: TextLabels
Find all spans that have a non-null value for this property.

Specified by:
getSpansWithProperty in interface TextLabels

getSpansWithProperty

public java.util.Iterator<Span> getSpansWithProperty(java.lang.String prop,
                                                     java.lang.String id)
Description copied from interface: TextLabels
Find all spans in the named document that have a non-null value for this property.

Specified by:
getSpansWithProperty in interface TextLabels

hasType

public boolean hasType(Span span,
                       java.lang.String type)
Description copied from interface: TextLabels
Query if a span has a given type.

Specified by:
hasType in interface TextLabels

instanceIterator

public java.util.Iterator<Span> instanceIterator(java.lang.String type)
Description copied from interface: TextLabels
Get all instances of a given type.

Specified by:
instanceIterator in interface TextLabels

instanceIterator

public java.util.Iterator<Span> instanceIterator(java.lang.String type,
                                                 java.lang.String documentId)
Description copied from interface: TextLabels
Get all instances of a given type.

Specified by:
instanceIterator in interface TextLabels

getTypes

public java.util.Set<java.lang.String> getTypes()
Description copied from interface: TextLabels
Return a set of all type names.

Specified by:
getTypes in interface TextLabels

getTypeSet

public java.util.Set<Span> getTypeSet(java.lang.String type,
                                      java.lang.String documentId)
Description copied from interface: TextLabels
Return the Set of all Spans with a given type in a given document

Specified by:
getTypeSet in interface TextLabels

isType

public boolean isType(java.lang.String type)
Description copied from interface: TextLabels
True if the given string names a type.

Specified by:
isType in interface TextLabels

closureIterator

public java.util.Iterator<Span> closureIterator(java.lang.String type)
Description copied from interface: TextLabels
Returns the spans s for in the given type is 'closed'. If type T is close inside S, this means that one can apply the 'closed world assumption' and assume that the known set of spans of type T is complete, except for areas of the text that are not contained by any closure span S.

Specified by:
closureIterator in interface TextLabels

closureIterator

public java.util.Iterator<Span> closureIterator(java.lang.String type,
                                                java.lang.String documentId)
Description copied from interface: TextLabels
Returns the spans S inside the given document in which the given type is 'closed'.

Specified by:
closureIterator in interface TextLabels

showTokenProp

public java.lang.String showTokenProp(TextBase base,
                                      java.lang.String prop)
Description copied from interface: TextLabels
For debugging. Returns a dump of all strings that have tokens with the given property.

Specified by:
showTokenProp in interface TextLabels

getDetails

public Details getDetails(Span span,
                          java.lang.String type)
Description copied from interface: TextLabels
Retrieve additional information associated with an assertion 'span S has type T'. Returns null if the span doesn't have the stated type.

Specified by:
getDetails in interface TextLabels

require

public void require(java.lang.String annotationType,
                    java.lang.String fileToLoad)
Description copied from interface: TextLabels
Ensure that this TextLabels contains a particular type of annotation. If the annotation is not present, then either load it (if possible) or throw an error.

Specified by:
require in interface TextLabels

require

public void require(java.lang.String annotationType,
                    java.lang.String fileToLoad,
                    AnnotatorLoader loader)
Description copied from interface: TextLabels
Ensure that this TextLabels contains a particular type of annotation. If the annotation is not present, then either load it (if possible) or throw an error. Use the provided annotatorLoader to find annotators rather than the default one.

Specified by:
require in interface TextLabels

annotateWith

public void annotateWith(java.lang.String annotationType,
                         java.lang.String fileToLoad)
Annotate labels with annotator named fileToLoad

Specified by:
annotateWith in interface TextLabels

setProperty

public void setProperty(Span span,
                        java.lang.String prop,
                        java.lang.String value)
Assert that Span span has the given value of the given property


toGUI

public Viewer toGUI()
Description copied from interface: Visible
Create a view of this object

Specified by:
toGUI in interface Visible