Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • new Node(value: Value): Node

Properties

end

end: boolean

next

next: NextNodes

Readonly value

value: Value

Methods

completePattern

completeWord

isLeaf

  • isLeaf(): boolean

matchChars

  • matchChars(word: string): null | Node
  • Given an word, returns the final node which matches the complete word. null otherwise.

    Parameters

    • word: string

    Returns null | Node

matchPattern

  • matchPattern(tokens: string[]): Match[]
  • Given an input sequence of words, a starting node, and a dictionary, finds all valid matching paths that the input satisfies.

    Simple Example

    If we have a starting node which yields the following sub-trie,

    t - r - i - e
          \
            e - e
    

    and input "tr", the returned node will be "r".

    Advanced Example

    With a more complex starting trie,

    null - a - b - c -   - d (1)
         \
           <X> -   - d (2)
    
    <X>: null - a - b - c
              \ 
                <Y>
    
    <Y>: null - a - b - c -   - d (3)
    

    given "abc d", it wll return the "d" nodes labeled (1), (2), (3)

    Since patterns can span multiple levels of nested contexts, we need to return not only the matched words (partially matched on completed words), but also the remainder of the match. This way, we can check for matches in parent contexts in case a pattern satisfies a match over an arbitrary number of contextual levels.

    Parameters

    • tokens: string[]

    Returns Match[]

matchWord

  • matchWord(tokens: string[]): Match[]
  • Parameters

    • tokens: string[]

    Returns Match[]

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Private property
  • Private method
  • Property

Generated using TypeDoc