edu.cmu.minorthird.text
Class AnnotatorLoader

java.lang.Object
  extended by edu.cmu.minorthird.text.AnnotatorLoader
Direct Known Subclasses:
DefaultAnnotatorLoader, EncapsulatingAnnotatorLoader

public abstract class AnnotatorLoader
extends java.lang.Object

Analogous to a ClassLoader, this finds annotators by name, so they can be applied to a set of labels.


Constructor Summary
AnnotatorLoader()
           
 
Method Summary
 Annotator findAnnotator(java.lang.String annotationType, java.lang.String source)
          Find an annotator for the given annotationType, from the listed source.
abstract  java.lang.Class<?> findClassResource(java.lang.String className)
          Find the named resource class - usually an annotator.
abstract  java.io.InputStream findFileResource(java.lang.String fileName)
          Find the named resource file - usually a dictionary or trie for mixup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotatorLoader

public AnnotatorLoader()
Method Detail

findFileResource

public abstract java.io.InputStream findFileResource(java.lang.String fileName)
Find the named resource file - usually a dictionary or trie for mixup.


findClassResource

public abstract java.lang.Class<?> findClassResource(java.lang.String className)
Find the named resource class - usually an annotator.


findAnnotator

public final Annotator findAnnotator(java.lang.String annotationType,
                                     java.lang.String source)
Find an annotator for the given annotationType, from the listed source. If the source is non-null, it attempted to be located via findFileResource and if it does not find it there it uses the findClassResource. If the source is null, the following rules are followed, in order, to find the source.
  1. If the classpath contains a file "annotation.properties" that defines the annotator source for 'foo' to be 'bar', follow the rules above for source 'bar' (i.e., find a file resource 'bar' if 'bar' ends in .mixup, and a class resource otherwise.)
  2. If one can find a file resource "foo.mixup", use that as the source.
  3. Use 'foo' as a class name.