Module: Fias::Name::HouseNumber
- Defined in:
- lib/fias/name/house_number.rb
Constant Summary collapse
- COLON =
/\,/- JUST_A_NUMBER =
/^[\s\d]+$/- STOPWORDS =
/(микрорайон|линия|микр|мкрн|мкр|лин)/ui
- LINE_OR_MICRODISTRICT =
/#{STOPWORDS}\.?[\s\w+]?\d+$/ui
- NUMBER =
/\d+\/?#{Fias::LETTERS}?\d*/ui
- ENDS_WITH_NUMBER =
/(#{NUMBER})$/ui
- HOUSE_WORDS =
%w(ом д дом вл кв)- HOUSE_WORD =
/(\s|\,|\.|^)(#{or_words(HOUSE_WORDS)})(\s|\,|\.|$)/ui
- HOUSING_WORDS =
%w(корпус корп к)- NUMBER_WITH_HOUSING =
/#{NUMBER}[\s\,\.]+(#{or_words(HOUSING_WORDS)})[\s\,\.]+#{NUMBER}/ui
Class Method Summary collapse
Class Method Details
.extract(name) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fias/name/house_number.rb', line 5 def extract(name) return [name, nil] unless contains_number?(name) name, number = try_split_by_colon(name) || try_housing(name) || try_house_word(name) || try_ends_with_number(name) [name.strip, number.strip] end |