Class: LulalalaAddressTokenizer

Inherits:
Object
  • Object
show all
Defined in:
lib/lulalala_address_tokenizer.rb,
lib/lulalala_address_tokenizer/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Constructor Details

#initialize(model_path) ⇒ LulalalaAddressTokenizer

Returns a new instance of LulalalaAddressTokenizer.



6
7
8
# File 'lib/lulalala_address_tokenizer.rb', line 6

def initialize(model_path)
  @model = Wapiti.load(model_path)
end

Instance Method Details

#parse(address) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/lulalala_address_tokenizer.rb', line 11

def parse(address)
  segments = []
  address.chars.each do |ch|
    segments << "#{ch} n"
  end
  result = @model.label [segments]
  join(result.first)
end