|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.upenn.cis.spinal.AbstractWalker
public abstract class AbstractWalker
Inherit from this abstract class to create standalone command-line applications
that operate on a file containing an LTAG-spinal annotated sentence or sentences.
See the other XYZWalker
classes in this packages for examples.
All inherited classes should include the following method:
public static void main(String argv[]) { new XYZWalker().process(argv); }
Field Summary | |
---|---|
protected String[] |
args
Contains the arguments that have been passed to process(String[]) . |
protected boolean |
terminate
Indicates whether terminate() has been called. |
Constructor Summary | |
---|---|
AbstractWalker()
|
Method Summary | |
---|---|
abstract void |
forEachSentence(Sentence t)
Implementations of this method should specify what the class should do on reading in a sentence (a derivation tree) from the file. |
protected String[] |
getArgs()
Returns the string array of arguments that has been passed to process(String[]) . |
protected abstract void |
init()
Implementations of this method should specify what (if anything) the class should do before attempting to read in a file. |
protected abstract void |
printUsage()
Implementations of this method should print out a short string to stdout
describing the function of the class. |
protected void |
process(String[] args)
This method calls init() , then opens a file in LTAG-spinal format
using the first element
of the args array as the filename, and reads in elementary trees from that file. |
protected void |
terminate()
Call this method from within forEachSentence(Sentence) to
instruct process(String[]) to skip any remaining sentences. |
protected abstract void |
wrapUp()
Implementations of this method should specify what (if anything) the class should do upon reading all sentences from the file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String[] args
process(String[])
.
protected boolean terminate
terminate()
has been called.
Constructor Detail |
---|
public AbstractWalker()
Method Detail |
---|
protected String[] getArgs()
process(String[])
.
protected void terminate()
forEachSentence(Sentence)
to
instruct process(String[])
to skip any remaining sentences.
process(String[])
will
still call wrapUp()
even after
this method is invoked.
protected void process(String[] args)
init()
, then opens a file in LTAG-spinal format
using the first element
of the args
array as the filename, and reads in elementary trees from that file.
On each of these trees, it calls forEachSentence(Sentence)
.
When terminate()
is called or the end of the file is reached,
the method calls wrapUp()
.
args
- an array of arguments. The first of them is used as a filename
to indicate the location of the file containing LTAG-spinal annotation.protected abstract void init()
public abstract void forEachSentence(Sentence t)
t
- the current Sentence
objectprotected abstract void wrapUp()
process(String[])
method also calls this if terminate()
has been invoked.
protected abstract void printUsage()
stdout
describing the function of the class. This method is automatically
called by process(String[])
when no command-line
argument is passed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |