Class: NHKore::ScrapeWordsResult
- Inherits:
-
Object
- Object
- NHKore::ScrapeWordsResult
- Defined in:
- lib/nhkore/article_scraper.rb
Overview
Instance Attribute Summary collapse
- #text ⇒ Object readonly
- #words ⇒ Object readonly
Instance Method Summary collapse
- #add_text(text) ⇒ Object
- #add_word(word) ⇒ Object
-
#initialize ⇒ ScrapeWordsResult
constructor
A new instance of ScrapeWordsResult.
- #polish! ⇒ Object
- #words? ⇒ Boolean
Constructor Details
#initialize ⇒ ScrapeWordsResult
Returns a new instance of ScrapeWordsResult.
643 644 645 646 647 648 |
# File 'lib/nhkore/article_scraper.rb', line 643 def initialize super() @text = ''.dup @words = [] end |
Instance Attribute Details
#text ⇒ Object (readonly)
640 641 642 |
# File 'lib/nhkore/article_scraper.rb', line 640 def text @text end |
#words ⇒ Object (readonly)
641 642 643 |
# File 'lib/nhkore/article_scraper.rb', line 641 def words @words end |
Instance Method Details
#add_text(text) ⇒ Object
650 651 652 653 654 |
# File 'lib/nhkore/article_scraper.rb', line 650 def add_text(text) @text << Util.reduce_jpn_space(text) return self end |
#add_word(word) ⇒ Object
656 657 658 659 660 |
# File 'lib/nhkore/article_scraper.rb', line 656 def add_word(word) @words << word return self end |
#polish! ⇒ Object
662 663 664 665 666 |
# File 'lib/nhkore/article_scraper.rb', line 662 def polish! @text = Util.strip_web_str(@text) return self end |
#words? ⇒ Boolean
668 669 670 |
# File 'lib/nhkore/article_scraper.rb', line 668 def words? return !@words.empty? end |