class TEST -- tests the GBN_TRIE multiple pattern-matching -- data-structure first described by -- Aho and Corasick. creation go feature go is local trie : GBN_TRIE text : STRING do !! trie.make (<<"hello","there","abracadabra">>) trie . show_backlinks !! text.copy ("Hello, hello, said the policeman, therefore") from trie.install ( text ) io.put_string ( trie.text ) io . put_new_line trie . find_match until not trie.match_found loop io.put_string ("match found position ") io.put_integer ( trie.start_of_match ) io.put_string ( ", length " ) io.put_integer ( trie.length_of_match ) io.put_string ( ", namely " ) io.put_string ( trie . matching_string ) io.put_new_line trie . find_match end from trie.install ( text ) io.put_string ( trie.text ) io . put_new_line trie . find_match until not trie.match_found loop io.put_string ("match found position ") io.put_integer ( trie.start_of_match ) io.put_string ( ", length " ) io.put_integer ( trie.length_of_match ) io.put_string ( ", namely " ) io.put_string ( trie . matching_string ) io.put_new_line trie . find_match_overlapping end !! text.copy ("abracadabracadabra") from trie.install ( text ) io.put_string ( trie.text ) io . put_new_line trie . find_match until not trie.match_found loop io.put_string ("match found position ") io.put_integer ( trie.start_of_match ) io.put_string ( ", length " ) io.put_integer ( trie.length_of_match ) io.put_string ( ", namely " ) io.put_string ( trie . matching_string ) io.put_new_line trie . find_match end from trie.install ( text ) io.put_string ( trie.text ) io . put_new_line trie . find_match until not trie.match_found loop io.put_string ("match found position ") io.put_integer ( trie.start_of_match ) io.put_string ( ", length " ) io.put_integer ( trie.length_of_match ) io.put_string ( ", namely " ) io.put_string ( trie . matching_string ) io.put_new_line trie . find_match_overlapping end end end -- class TEST