Skip to content

Phrase Tree Architecture

F-Dudley edited this page Apr 26, 2025 · 2 revisions

Phrase Tree Architecture

All components of the Phrase Tree derive from the base class FPhraseNode.
This class is the base for all nodes in the tree. With each node following the same structure, for easy traversal.

Each Phrase Node contains methods for:

  • Checking if the node Requires the provided Phrase String.
  • Parsing the Phrase String, recording any Node Type processing, and forwarding to any child nodes.
  • Check if the node is a leaf node.
  • Check if the node has a leaf child.

Node Types

  • Basic Node - Generic node with no special properties but uses fuzzy matching (Levenshtein distance) to match the provided phrase, with an acceptance of 2 deviations.
  • Input Node - Nodes that require acceptable input from the phrase (IE: "0", "1", "UP", "DOWN", etc). With the accepted input being recorded during propagation.
  • Context Node - Nodes that still use fuzzy matching for the provided phrase but change the "Mode" of the editor and phrase tree (IE: "Context Menus", "Movement Modes", etc), with the Context Node becoming the new propagation root until the "Mode" object loses focus or is closed.
  • Event Node - Nodes that have no input requirements but trigger a Phrase Tree Function Event upon reaching them.

Propagation

Propagation is started from the Tree Root Node (FPhraseTree), with the passed in Transcription String being split into individual words. With the Phrase Tree being used as the starting active node, going straight to its ParsePhrase method.

The following structure is recursively followed, until a leaf node (event node) is reached or a failure for propagation is met:

  • From the current active node, the children are tested for a match with the current word (Last Phrase In Split Transcription Array), using the RequiresPhrase method monitoring distancing using Levenshtein Distance. With the closest found distance being the next target for propagation.
  • If a valid target for propagation is found, the ParsePhrase method is called on the target, with the function removing its matching word from the transcription array.

Phrase Tree Propagation Diagram

Clone this wiki locally