Prefix tree on a word basis

51 views
Skip to first unread message

Stefan Bunk

unread,
Jun 6, 2014, 9:32:06 AM6/6/14
to concurrent-t...@googlegroups.com
Hi,

I would like to use a trie for my current project, but not an a character-basis but rather on a word-basis.

RadixTree<Integer> tree = new ConcurrentRadixTree<Integer>(new DefaultCharArrayNodeFactory());

tree
.put("TEST TABLE", 1);
tree
.put("TEST TOAST TEA", 2);
tree
.put("TEST TOAST TENNIS", 3); // alternatively supply a list of words directly

└── ○ TEST
    ├── ○ TOAST
    │   ├── ○ TEA (2)
    │   └── ○ TENNIS (3)
    └── ○ TABLE (1)


Is it possible to use the existing interface in any way to accomplish this, and if not, how much work would it be to adapt the code?

Kind regards
Stefan


Niall Gallagher

unread,
Jun 6, 2014, 11:58:46 AM6/6/14
to concurrent-t...@googlegroups.com
Hi Stefan,

Do you want to do lookups on the tree based on entries being prefixed by whole words? That is supported actually. See: InMemoryFileSystemUsage for an example of something similar.

Basically the internal structure of the tree will not always be split on word boundaries. But you can get the tree to *behave* as if it was split on word boundaries, if you add special characters to the entries you put in the tree *and* in your queries on the tree.

HTH,
Niall




--
-- You received this message because you are subscribed to the "concurrent-trees-discuss" group.
http://groups.google.com/group/concurrent-trees-discuss
---
You received this message because you are subscribed to the Google Groups "concurrent-trees-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to concurrent-trees-d...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages