aho-corasick-string-replacement
replace multiple strings with multiple other strings in a single pass uses the aho-corasick string search algorithm, but only considers the first longest match
usage
process_text
<-- replace stuff in a stringprocess_file
<-- replace stuff in a text filefind_all
<-- find stuff in a stringto_regex
<-- convert the entire trie into a regex
todo
- make readme
- neaten and refactor code into multiple files
- convert trie to DFA by computing suffix/failure links
- parallel work sharing to make processing faster
- add code history from 2016
- split out the tokenizer maybe
- cleanup and deconflict interfaces
- list-style interface (with slices)
- set-style interface (add, remove)
- dict-style interface (like a set, but with keys)
- iterator-style interface
- regex interface (improve regex optimization, more like re.findall/match/etc)
__del__
- disable
fromkeys()
once created