public class ParsingSceneRecognizer extends Object implements SceneRecognizer
The grammar is expressed as an array of rules, and the rules are indexed inside the parser according to the types of tokens that they consume. This means that every time a token is added to the scene, the appropriate rules are retrieved from the index and the rest of the required tokens are searched for in the database. All permutations of possible matches are fed to a rule, and if the rule matches, the resulting token is fed back into the process.
Grammar2D
Constructor and Description |
---|
ParsingSceneRecognizer(SceneRecognizer child,
Grammar2D grammar)
Construct a new parser with the specified grammar rules, that
uses the given child recognizer to perform lower-level
recognition.
|
Modifier and Type | Method and Description |
---|---|
static void |
debug(String s)
Debugging output.
|
Grammar2D |
getGrammar()
Return the grammar that is used to perform the parsing.
|
protected SceneDeltaSet |
handleDeltas(SceneDeltaSet deltas,
Scene db)
Handle any deltas that may have occurred in the scene from the
addition, modification, or completion of strokes/sessions to
the scene database.
|
SceneDeltaSet |
parse(CompositeElement e,
Scene db)
Perform a recursive, incremental parse of the element
in the given scene, adding the results to the given
delta set.
|
SceneDeltaSet |
sessionCompleted(StrokeElement[] session,
Scene db)
Pass the "session started" information to the child recognizer
and handle the results if there are changes in the scene.
|
SceneDeltaSet |
strokeCompleted(StrokeElement stroke,
Scene db)
Pass the "stroke completed" information to the child recognizer
and handle the results if there are changes in the scene.
|
SceneDeltaSet |
strokeModified(StrokeElement stroke,
Scene db)
Pass the "stroke modified" information to the child recognizer
and handle the results if there are changes in the scene.
|
SceneDeltaSet |
strokeStarted(StrokeElement stroke,
Scene db)
Pass the "stroke started" information to the child recognizer
and handle the results if there are changes in the scene.
|
public ParsingSceneRecognizer(SceneRecognizer child, Grammar2D grammar)
public Grammar2D getGrammar()
public SceneDeltaSet strokeStarted(StrokeElement stroke, Scene db)
strokeStarted
in interface SceneRecognizer
public SceneDeltaSet strokeModified(StrokeElement stroke, Scene db)
strokeModified
in interface SceneRecognizer
public SceneDeltaSet strokeCompleted(StrokeElement stroke, Scene db)
strokeCompleted
in interface SceneRecognizer
public SceneDeltaSet sessionCompleted(StrokeElement[] session, Scene db)
sessionCompleted
in interface SceneRecognizer
protected SceneDeltaSet handleDeltas(SceneDeltaSet deltas, Scene db)
public SceneDeltaSet parse(CompositeElement e, Scene db)
public static void debug(String s)
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.