Class: NLP::PlTrie
- Inherits:
-
Trie
- Object
- Trie
- NLP::PlTrie
- Defined in:
- lib/dictionaries/pl_trie.rb
Constant Summary collapse
- ALPHABET =
%w{- a ą b c ć d e ę f g h i j k l ł m n ń o ó p r s ś t u v w x y z ź ż} << ' '
Instance Method Summary collapse
-
#priv_insert(s, value) ⇒ Object
private.
Instance Method Details
#priv_insert(s, value) ⇒ Object
private
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dictionaries/pl_trie.rb', line 12 def priv_insert(s, value) if s.empty? if @data.nil? @data = [value] else @data.push value end else index = key(s.first) subtree = if @children[index] @children[index] else @children[index] = PlTrie.new end subtree.priv_insert(s[1..-1], value) end end |