View Source AhoCorasickNif.Native.BuilderOptions (aho_corasick_nif v0.1.0-beta.2)

Struct to represent the options passed to the builder.

The options are:

  • :aho_corasick_kind - the kind of Aho-Corasick algorithm to use
    • nil - use the default algorithm (it makes the chose based ont pattern counts)
    • :noncontiguous_nfa - use the noncontiguous NFA algorithm
    • :contiguous_nfa - use the contiguous NFA algorithm
    • :dfa - use the DFA algorithm
  • :ascii_case_insensitive - whether to ignore case for ASCII characters
  • :byte_classes - whether to use byte classes
  • :dense_depth - the depth at which to switch to the dense representation
    • nil - use the default depth (it uses defaults for each automata type)
    • non_neg_integer() - use the given depth
  • :match_kind - the kind of match to return
    • :standard - return all matches
    • :leftmost_longest - return the leftmost longest match
    • :leftmost_first - return the leftmost first match
  • :prefilter - whether to use the prefilter
  • :start_kind - the kind of start to use
    • :both - match both anchored and unanchored patterns
    • :unanchored - match only unanchored patterns
    • :anchored - match only anchored patterns

Summary

Types

The kind of Aho-Corasick algorithm to use.

The match kind to return.

The start kind to use.

t()

The options passed to the builder.

Functions

Validate the options passed to the builder.

Validate the options passed to the builder and raise an error if invalid.

Types

@type aho_corasick_kind() :: nil | :noncontiguous_nfa | :contiguous_nfa | :dfa

The kind of Aho-Corasick algorithm to use.

  • nil - use the default algorithm (it makes the chose based ont pattern counts)
  • :noncontiguous_nfa - use the noncontiguous NFA algorithm
  • :contiguous_nfa - use the contiguous NFA algorithm
  • :dfa - use the DFA algorithm
@type match_kind() :: :standard | :leftmost_longest | :leftmost_first

The match kind to return.

  • :standard - return all matches
  • :leftmost_longest - return the leftmost longest match
  • :leftmost_first - return the leftmost first match
@type start_kind() :: :both | :unanchored | :anchored

The start kind to use.

  • :both - match both anchored and unanchored patterns
  • :unanchored - match only unanchored patterns
  • :anchored - match only anchored patterns
@type t() :: %AhoCorasickNif.Native.BuilderOptions{
  aho_corasick_kind: nil | aho_corasick_kind(),
  ascii_case_insensitive: boolean(),
  byte_classes: boolean(),
  dense_depth: nil | non_neg_integer(),
  match_kind: match_kind(),
  prefilter: boolean(),
  start_kind: start_kind()
}

The options passed to the builder.

See module documentation for details.

Functions

@spec validate(t()) :: {:ok, t()} | {:error, [String.t()]}

Validate the options passed to the builder.

@spec validate!(t()) :: t()

Validate the options passed to the builder and raise an error if invalid.