bramstein / datrie

A JavaScript Double Array Trie
21 stars 2 forks source link

Fixed code to handle some cases that would break the trie #1

Closed jpdurham closed 10 years ago

jpdurham commented 10 years ago

The following two examples that will not yield correct results prior to my modifications:


Example 1: trie.insert("abc#"); trie.insert("ab#"); trie.insert("abb#");


Example 2: trie.insert("test#"); trie.insert("tests#"); trie.insert("testss#"); trie.insert("tear#");

bramstein commented 10 years ago

This is really great! I've been meaning to fix those bugs. Awesome! Would you mind adding those two test cases to the test suite? I'll merge in your fixes afterwards.

jpdurham commented 10 years ago

Sure thing! I'll take care of that tonight.

jpdurham commented 10 years ago

The above cases are now included in the test suite.

bramstein commented 10 years ago

Thanks a lot, it is merged in and I released a new version.

Out of curiosity, what are you using it for?

jpdurham commented 10 years ago

No problem!

I wrote a Python implementation of a DAT for retrieving various Unicode character data in a UTF-8 string processing library. The library is being written in C, but I'm using Python to generate the C code. My hope is that upon completion of the C implementation of the library, I can release a JavaScript version. I was also looking into writing a text completion program using it.

Sorry for the delayed reply. I could swear I posted an answer shortly after you asked it, but apparently it got lost..