Function fromWords

  • This eagerly creates an FA that accepts exactly all the given words.

    The construction is already finished when this method returns, so the returned FA iterator does not have to be used.

    The construction will create a DFA by default. However, the FA builder implementation has to be carefully chosen to preserve the determinism. In order for the determinism to be preserved, builder and getOutState have to fulfill the following conditions:

    • Let x, y be any 2 states of builder and c be any valid character <= maxCharacter. Iff this function called builder.linkNodes(x, y, c), then getOutState(builder, x, c) == y.
    • builder has to be an empty FA when given to this method.
    • builder.makeFinal(x) must have no effect on getOutState.

    Type Parameters

    • S

    Parameters

    • builder: FABuilder<S, CharSet>
    • getOutState: ((state: S, char: Char) => undefined | S)
        • (state: S, char: Char): undefined | S
        • Parameters

          • state: S
          • char: Char

          Returns undefined | S

    • words: Iterable<ReadonlyWord>
    • maxCharacter: Char

    Returns FAIterator<S, S>