Package Bio :: Module triefind
[hide private]
[frames] | no frames]

Module triefind

source code

Given a trie, find all occurrences of a word in the trie in a string.

Like searching a string for a substring, except that the substring is any word in a trie.

Functions: match Find longest key in a trie matching the beginning of the string. match_all Find all keys in a trie matching the beginning of the string. find Find keys in a trie matching anywhere in a string. find_words Find keys in a trie matching whole words in a string.

Functions [hide private]
longest key or None
match(string, trie)
Find the longest key in the trie that matches the beginning of the string.
source code
list of keys
match_all(string, trie)
Find all the keys in the trie that matches the beginning of the string.
source code
list of tuples (key, start, end)
find(string, trie)
Find all the keys in the trie that match anywhere in the string.
source code
list of tuples (key, start, end)
find_words(string, trie)
Find all the keys in the trie that match full words in the string.
source code
Variables [hide private]
  DEFAULT_BOUNDARY_CHARS = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~\t...
  __package__ = 'Bio'
Function Details [hide private]

find_words(string, trie)

source code 
Find all the keys in the trie that match full words in the string. Word boundaries are defined as any punctuation or whitespace.
Returns: list of tuples (key, start, end)

Variables Details [hide private]

DEFAULT_BOUNDARY_CHARS

Value:
'''!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~\t
\x0b\x0c\r '''