Structureswift-transformers 0.1.17Tokenizers
Trie
Trie.swift:11struct Trie<T> where T : Hashable
struct Trie<T> where T : Hashable
import Tokenizers
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
init(root: Node? = nil)
typealias Node = TrieNode<T>
func append(contentsOf container: any Sequence<any Sequence<T>>)
func commonPrefixSearch(_ text: any Sequence<T>) -> [[T]]
Find all leaf nodes that share a common prefix with the input sequence (usually a text) Returns an array
func commonPrefixSearchIterator(_ text: any Sequence<T>) -> LeavesWithCommonPrefixIterator<T>
Find all leaf nodes that share a common prefix with the input sequence (usually a text) Returns an iterator
func get(_ element: any Sequence<T>) -> Node?
func insert(_ element: any Sequence<T>)