Index: src/natools-smaz-tools.adb ================================================================== --- src/natools-smaz-tools.adb +++ src/natools-smaz-tools.adb @@ -514,10 +514,22 @@ for I in Dict.Offsets'Range loop Dictionary_Maps.Insert (Search_Map, Dict_Entry (Dict, I), I); end loop; end Set_Dictionary_For_Map_Search; + + procedure Set_Dictionary_For_Trie_Search (Dict : in Dictionary) is + begin + Initialize (Trie_For_Search, Dict); + end Set_Dictionary_For_Trie_Search; + + + function Trie_Search (Value : String) return Natural is + begin + return Search (Trie_For_Search, Value); + end Trie_Search; + ------------------- -- Word Counting -- ------------------- Index: src/natools-smaz-tools.ads ================================================================== --- src/natools-smaz-tools.ads +++ src/natools-smaz-tools.ads @@ -78,10 +78,15 @@ type Search_Trie is private; procedure Initialize (Trie : out Search_Trie; Dict : in Dictionary); function Search (Trie : in Search_Trie; Value : in String) return Natural; -- Trie-based search in a dynamic dictionary, for lookup whose -- speed-vs-memory is even more skewed towards speed. + + procedure Set_Dictionary_For_Trie_Search (Dict : in Dictionary); + function Trie_Search (Value : String) return Natural; + -- Function and data source for trie-based search that can be + -- used with Dictionary.Hash. type String_Count is range 0 .. 2 ** 31 - 1; -- Type for a number of substring occurrences type Word_Counter is private; @@ -185,7 +190,9 @@ type Search_Trie is record Not_Found : Natural; Root : Trie_Node (False); end record; + + Trie_For_Search : Search_Trie; end Natools.Smaz.Tools;