You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I might be missing something out here, but I believe there is a consistency issue with the Trie implementation and keys that have null characters.
Take a look at the following code snippet:
key='Random\x00Key'python_dict= { key : 'random_value' }
keyinpython_dict# prints Truepython_dict.get(key) # returns 'random_value'std_trie=marisa_trie.Trie(python_dict)
keyinstd_trie# prints Truestd_trie.keys() # prints ['Random\x00Key']std_trie.get(key) # should return 'random_value'std_trie.key_id(key) # should return the key id
What happens is that std_trie.get(key) actually returns None, and std_trie.key_id(key) throws a KeyError exception with the following trace:
Apparently, the RecordTrie implementation is immune to this consistency issue.
r_trie=marisa_trie.RecordTrie('<H', zip([key], [(1,)]))
keyinr_trie# prints Truer_trie.keys() # prints ['Random\x00Key']r_trie.get(key) # prints [(1,)]
By the way, if you confirm this issue as an actual bug, also check DAWG. I haven't used it extensively, but calling dawg.DAWG(python_dict) should throw the following error:
I might be missing something out here, but I believe there is a consistency issue with the
Trie
implementation and keys that have null characters.Take a look at the following code snippet:
What happens is that
std_trie.get(key)
actually returnsNone
, andstd_trie.key_id(key)
throws aKeyError
exception with the following trace:Apparently, the
RecordTrie
implementation is immune to this consistency issue.By the way, if you confirm this issue as an actual bug, also check DAWG. I haven't used it extensively, but calling
dawg.DAWG(python_dict)
should throw the following error:I'm running
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
and usingmarisa-trie 0.7.5
andDAWG 0.7.8
.The text was updated successfully, but these errors were encountered: