|
||||||||
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 invokes methods from the Cyc
class as certain Inspector events are
fired, essentially implementing the VxC application. The approach VxC takes to extending
the Inspector is to put as little code into the EventManager
class as possible,
and utilize external classes for all additional required code (Cyc
, Matcher
,
and PrepositionManager
in this case).
At the beginning of the program
the Cyc
class is asked to initialize itself and read in both the Cyc
verbSemTrans
rules as well as the manual mapping file. At the start
of each class or subclass the event tells the Cyc
class what the current
class being processed is. The class depth is also kept track of with classLevel
. This is only used to implement the print class match
counts feature (Cyc.flShowClassMatchCounts
, -Sc on command-line). At the
end of the program the Cyc
class is called upon to close any external
files it needs to and to print the final statistics of the automatic matching.
For VxC to function correctly, the Inspector must be running in verb-frame
mode. Therefore, the -q option is mandatory for each execution (-Vq also works
but no normal output is required to be printed).
That said, the only other real processing that takes place in this class
happens at the end of each verb-frame pair. At this point, the syntax and semantics for the
verb-frame pair has been visited and saved to syn
and sem
and
all remaining required information is stored in the text
parameter
of the method. The Cyc
class is called upon look for any matches
present for the given VerbNet verb-frame pair.
See the EVENT_PROGRAM, EVENT_CLASS, EVENT_SUBCLASS, EVENT_SYNTAX, EVENT_SEMANTIC_PRED, EVENT_VF_PAIR,
and EVENT_END_FRAMES events.
fireEvent(int, int, String, String, String, Element, Element)
Field Summary | |
---|---|
private static int |
classLevel
Stores the depth of the current class or subclass. |
(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. |
private static String |
sem
The semantics of the given verb-frame pair. |
private static String |
syn
The syntax of the given verb-frame pair. |
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)
Captures events from the Inspector scanning system and passes relevant information from the XML files onto the Cyc class so that it can look for possible
matches between the VerbNet and Cyc. |
(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 |
---|
private static String syn
fireEvent(int, int, String, String, String, Element, Element)
private static String sem
fireEvent(int, int, String, String, String, Element, Element)
private static int classLevel
Cyc.flShowClassMatchCounts
, -Sc on command-line).
See the EVENT_CLASS, EVENT_SUBCLASS, and EVENT_END_FRAMES events.
fireEvent(int, int, String, String, String, Element, Element)
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)
Cyc
class so that it can look for possible
matches between the VerbNet and Cyc. For VxC to function it must be running in
verb-frame pair mode. This means that the member and frame events do not fire,
but rather the verb-frame pair events fire. Upon visiting each verb-frame pair,
the verb, syntax, semantics and frame information are sent to the Cyc
class to be
compared to all the relevant Cyc rules. When this method captures the 'end'
of program event, it asks the Cyc
class to print its results.
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.Cyc.initialize()
,
Cyc.loadExternalData()
,
Cyc.closeExternalData()
,
Cyc.compareMatches()
,
Cyc.setClass(String)
,
Cyc.findCycMatches(String, String, String, int, String)
,
Cyc.printClassMatchCount(int)
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. One error message has been added to this method for the
VxC extension of the Inspector. 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 |