Class: Werd::PosFilter

Inherits:
Object
  • Object
show all
Includes:
Contracts
Defined in:
lib/werd/pos_filter.rb

Class Method Summary collapse

Class Method Details

.filter(wordlist) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/werd/pos_filter.rb', line 6

def self.filter(wordlist)
  pos = Moby::PartsOfSpeech.new
  wordlist.select do |row|
    word = pos.find(row.first)[:pos]
    next(false) if word.include?(:pronoun)
    next(false) if word.include?(:definite_article)
    next(false) if word.include?(:preposition)
    next(false) if word.include?(:conjunction)
    next(false) if word.include?(:verb_usu_participle)
    true
  end
end