|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvn.EventManager
public class EventManager
This class contains the method that researchers will modify to extend the Inspector
to other natural language processing tasks. This method is:
fireEvent(int, int, String, String, String, Element, Element)
All events that are fired during the scanning of the VerbNet XML files end here.
The arguments passed to this method provide the context for the location where
the event fired. The information given to this method is:
Element
objects from the Java XML DOM that represent the XML element from the fileElement
objects.
Element
object can be accessed and traversed with these methods:
Events exist for the majority of elements within the XML files.
Events do not fire for XML elements such as <VERB/>
or <ADV/>
as those are absorbed into the events that fire for <SYNTAX>
.
Events do not fire for the <SEMANTICS>
element as whole but rather
for each individual <PRED>
element inside. Finally, events fire for
two addition "elements" - which are not elements in the XML sense. These are PROGRAM and FILE.
This allows for futher control over firing code when needed.
Inspector
,
Sweeper
, and EventManager
classes) provide some more
logistical details about the software.
%Agent
). Look at the UVI's key or
the Inspector's key (-k option on command line) for more information.
javac
1.4.2. The reason for this was so
researchers did not need to download and run Java 1.5 for this software. This software
will however work with Java 1.5. If you do not have Java installed on your system,
download the most recent release
right here.
Also, here are links to the 1.4.2 documentation
and the 1.5.0 documentation.
Field Summary | |
---|---|
(package private) static int |
EVENT_CLASS
Identifies that the event is for a main class. |
(package private) static int |
EVENT_END
Identifies that the event firing corresponds to the end of the element in question. |
(package private) static int |
EVENT_END_FRAMES
Identifies the moment right before another class begins. |
(package private) static int |
EVENT_EXAMPLE
Identifies that the event is for an example. |
(package private) static int |
EVENT_FILE
Identifies that the event is for a single XML file. |
(package private) static int |
EVENT_FRAME
Identifies that the event is for a frame. |
(package private) static int |
EVENT_MEMBER
Identifies that the event is for a single member (verb). |
(package private) static int |
EVENT_PROGRAM
Identifies that the event is for the entire program. |
(package private) static int |
EVENT_SEMANTIC_PRED
Identifies that the event is for a single semantic predicate. |
(package private) static int |
EVENT_START
Identifies that the event firing corresponds to the beginning of the element in question. |
(package private) static int |
EVENT_SUBCLASS
Identifies that the event is for a subclass. |
(package private) static int |
EVENT_SYNTAX
Identifies that the event is for syntax. |
(package private) static int |
EVENT_THEMROLE
Identifies that the event is for a thematic role. |
(package private) static int |
EVENT_VF_PAIR
Identifies that the event is for a verb-frame pair. |
private static PrintStream |
originalStdOut
The original stdout stream reference from the System class. |
Constructor Summary | |
---|---|
private |
EventManager()
This constructor is private because the class is not intended to ever be instantiated. |
Method Summary | |
---|---|
(package private) static void |
fireEvent(int type,
int startOrEnd,
String curFile,
String curClass,
String text,
Element n,
Element nExtra)
Executes custom code specific to each type of element as they are encountered in the VerbNet XML files. |
(package private) static void |
fireEventMaybe(int type,
int startOrEnd,
String curFile,
String curClass,
String text,
Node n,
Node nExtra)
Fires an event if events are enabled for this execution of the Inspector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final int EVENT_START
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_END
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_PROGRAM
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_FILE
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_CLASS
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_SUBCLASS
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_MEMBER
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_THEMROLE
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_FRAME
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_EXAMPLE
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_SYNTAX
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_SEMANTIC_PRED
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_VF_PAIR
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_END_FRAMES
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesprivate static PrintStream originalStdOut
System
class.
This is saved in the static initializer for this class and exists just in case
the stdout stream is reset to a custom file in the
fireEvent(int, int, String, String, String, Element, Element)
.
A researcher can use this reference to reset the System
class's stdout
stream back to the original stream whenever desired.
System.out
,
System.setOut(PrintStream)
Constructor Detail |
---|
private EventManager()
Method Detail |
---|
static void fireEvent(int type, int startOrEnd, String curFile, String curClass, String text, Element n, Element nExtra)
Element
object is supplied
so as to give the researcher flexibility in how they access the VerbNet data.
The text
argument (a string) can be parsed or the Element
object can
be traversed. If using the latter, refer to the following methods:
The text
argument for all 'end' events is the same as the
text
argument for the corresponding 'start' events. This is so when
an 'end' event fires, one can easily identify the specific element to which
the event corresponds. This argument does not include leading spaces regardless of -i
operator.
try { System.setOut( new PrintStream( "file.txt" ) ); } catch( Exception e ) { e.printStackTrace(); }You can reset the
System
class's stdout writer to the original
stream in the 'end' event for PROGRAM with:
System.setOut( originalStdOut );The variable
originalStdOut
is a pre-defined class
variable that is ready for use.
type
- the type of element to which this event corresponds
(EVENT_PROGRAM
, EVENT_FILE
, etc.)startOrEnd
- whether this event is for the beginning of the
element or the end of the element
(EVENT_START
or EVENT_END
)curFile
- the name of the file currently being processed (i.e. approve-77.xml). This argument is
null
for the PROGRAM element.curClass
- the name of the class or subclass currently being processed (i.e. devour-39.4-1).
This argument is null
for the PROGRAM and FILE elements.text
- the simple-text representation of the element to which this
event corresponds. This text is equivalent to the text that would be
printed for this element had it been printed by the Inspector under the
view options -Vab (full output). For the PROGRAM element, this argument is
equal to the concatenation of all the command line elements with spaces.n
- the XML node corresponding to the element being visited. This argument is
null
for the PROGRAM and FILE elements. For verb-frame pairs,
this is the XML node corresponding to the MEMBER element in the verb-frame
pair.nExtra
- the XML node corresponding to the FRAME element in the verb-frame
pair being visited. This argument is null
for all other elements.static void fireEventMaybe(int type, int startOrEnd, String curFile, String curClass, String text, Node n, Node nExtra)
fireEvent
method. It also makes a quick conversion between
Node
s and Element
s for code simplification
purposes only. Do not modify this method.
type
- the type of element to which this event corresponds
(EVENT_PROGRAM
, EVENT_FILE
, etc.)startOrEnd
- whether this event is for the beginning of the
element or the end of the element
(EVENT_START
or EVENT_END
)curFile
- the name of the file currently being processed (i.e. approve-77.xml). This argument is
null
for the PROGRAM element.curClass
- the name of the class or subclass currently being processed (i.e. devour-39.4-1).
This argument is null
for the PROGRAM and FILE elements.text
- the simple-text representation of the element to which this
event corresponds. This text is equivalent to the text that would be
printed for this element had it been printed by the Inspector under the
view options -Vab (full output). For the PROGRAM element, this argument is
equal to the concatenation of all the command line elements with spaces.n
- the XML node corresponding to the element being visited. This argument is
null
for the PROGRAM and FILE elements. For verb-frame pairs,
this is the XML node corresponding to the MEMBER element in the verb-frame
pair.nExtra
- the XML node corresponding to the FRAME element in the verb-frame
pair being visited. This argument is null
for all other elements.fireEvent(int, int, String, String, String, Element, Element)
,
Inspector.flSuppressEvents
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |