Class: NHKore::BasicPolisher
- Defined in:
- lib/nhkore/polisher.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from Polisher
#begin_polish, #polish, polish_any
Instance Method Details
#end_polish(str) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/nhkore/polisher.rb', line 52 def end_polish(str) # Keep Japanese dots in names: # - Yunibaasaru・Sutajio・Japan # Keep numbers next to kanji/kana, else the below kana won't make sense: # - Word { kanji: 20日, kana: はつか } str = str.gsub(/[^[[:alnum:]]・]/,'') # Numbers/dots by themselves (without kanji/kana) should be ignored (empty). str = '' if str.gsub(/[[[:digit:]]・]+/,'').empty? return str end |