Module: AtlasEngine::ValidationTranscriber::AddressParsingHelper

Extended by:
T::Sig
Included in:
AddressParserPreprocessor, EnglishStreetParser, FrenchStreetParser
Defined in:
app/lib/atlas_engine/validation_transcriber/address_parsing_helper.rb

Instance Method Summary collapse

Instance Method Details

#address_constantsObject



10
11
12
13
14
15
# File 'app/lib/atlas_engine/validation_transcriber/address_parsing_helper.rb', line 10

def address_constants
  @address_constants ||= T.let(
    Constants.instance,
    T.nilable(Constants),
  )
end

#directional?(token) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
# File 'app/lib/atlas_engine/validation_transcriber/address_parsing_helper.rb', line 18

def directional?(token)
  return false if token.blank?

  downcased = token.downcase
  english = address_constants.translations_fr_en[downcased.to_sym] || downcased

  address_constants.known?(:directionals, english)
end

#street_suffix?(token) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
# File 'app/lib/atlas_engine/validation_transcriber/address_parsing_helper.rb', line 28

def street_suffix?(token)
  return false if token.blank?

  downcased = token.downcase
  english = address_constants.translations_fr_en[downcased.to_sym] || downcased

  address_constants.known?(:street_suffixes, english)
end