Class: JapaneseAddressParser::AddressNormalizer::NormalizeJapaneseAddressesSchmoozer

Inherits:
Schmooze::Base
  • Object
show all
Defined in:
lib/japanese_address_parser/address_normalizer/normalize_japanese_addresses_schmoozer.rb

Constant Summary collapse

JS_PACKAGE_PATH =
::File.expand_path('../../../js', current_dir)
JAPANESE_API_PATH =
"file://#{::File.expand_path('../data/geolonia-japanese-addresses/api/ja', current_dir)}"

Class Method Summary collapse

Class Method Details

.call(full_address) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/japanese_address_parser/address_normalizer/normalize_japanese_addresses_schmoozer.rb', line 20

def self.call(full_address)
  schmoozer = new(::JapaneseAddressParser::AddressNormalizer::NormalizeJapaneseAddressesSchmoozer::JS_PACKAGE_PATH)

  # 町丁目データを取得するAPIとしてローカルにあるファイルを指定する。
  # Web APIを利用しないようにすることで処理の効率を向上する。
  # 参考: https://github.com/geolonia/normalize-japanese-addresses#configjapaneseaddressesapi-string
  schmoozer.set_japanese_api_path(::JapaneseAddressParser::AddressNormalizer::NormalizeJapaneseAddressesSchmoozer::JAPANESE_API_PATH)

  schmoozer.normalize(full_address)
end