Class: Moby::PartsOfSpeech
- Inherits:
-
Object
- Object
- Moby::PartsOfSpeech
- Defined in:
- lib/moby/parts_of_speech.rb
Instance Method Summary collapse
- #adjective?(word) ⇒ Boolean
- #adjectives ⇒ Object
- #adverb?(word) ⇒ Boolean
- #adverbs ⇒ Object
- #conjunction?(word) ⇒ Boolean
- #conjunctions ⇒ Object
- #definite_article?(word) ⇒ Boolean
- #definite_articles ⇒ Object
- #find(word) ⇒ Object
- #indefinite_article?(word) ⇒ Boolean
- #indefinite_articles ⇒ Object
- #interjection?(word) ⇒ Boolean
- #interjections ⇒ Object
- #nominative?(word) ⇒ Boolean
- #nominatives ⇒ Object
-
#noun?(word) ⇒ Boolean
Query methods.
- #noun_phrase?(word) ⇒ Boolean
- #noun_phrases ⇒ Object
-
#nouns ⇒ Object
Word list methods.
- #plural?(word) ⇒ Boolean
- #plurals ⇒ Object
- #preposition?(word) ⇒ Boolean
- #prepositions ⇒ Object
- #pronoun?(word) ⇒ Boolean
- #pronouns ⇒ Object
- #verb?(word, options = {:type => :all}) ⇒ Boolean
- #verbs(options = {:type => :all}) ⇒ Object
Instance Method Details
#adjective?(word) ⇒ Boolean
46 |
# File 'lib/moby/parts_of_speech.rb', line 46 def adjective?(word); pos?(word, :adjective); end |
#adjectives ⇒ Object
16 |
# File 'lib/moby/parts_of_speech.rb', line 16 def adjectives; words(:adjective); end |
#adverb?(word) ⇒ Boolean
47 |
# File 'lib/moby/parts_of_speech.rb', line 47 def adverb?(word); pos?(word, :adverb); end |
#adverbs ⇒ Object
17 |
# File 'lib/moby/parts_of_speech.rb', line 17 def adverbs; words(:adverb); end |
#conjunction?(word) ⇒ Boolean
48 |
# File 'lib/moby/parts_of_speech.rb', line 48 def conjunction?(word); pos?(word, :conjunction); end |
#conjunctions ⇒ Object
18 |
# File 'lib/moby/parts_of_speech.rb', line 18 def conjunctions; words(:conjunction); end |
#definite_article?(word) ⇒ Boolean
52 |
# File 'lib/moby/parts_of_speech.rb', line 52 def definite_article?(word); pos?(word, :definite_article); end |
#definite_articles ⇒ Object
22 |
# File 'lib/moby/parts_of_speech.rb', line 22 def definite_articles; words(:definite_article); end |
#find(word) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/moby/parts_of_speech.rb', line 3 def find(word) { :word => word, :found => pos.has_key?(word), :code => pos_code(word), :pos => pos_breakdown(word) } end |
#indefinite_article?(word) ⇒ Boolean
53 |
# File 'lib/moby/parts_of_speech.rb', line 53 def indefinite_article?(word); pos?(word, :indefinite_article); end |
#indefinite_articles ⇒ Object
23 |
# File 'lib/moby/parts_of_speech.rb', line 23 def indefinite_articles; words(:indefinite_article); end |
#interjection?(word) ⇒ Boolean
50 |
# File 'lib/moby/parts_of_speech.rb', line 50 def interjection?(word); pos?(word, :interjection); end |
#interjections ⇒ Object
20 |
# File 'lib/moby/parts_of_speech.rb', line 20 def interjections; words(:interjection); end |
#nominative?(word) ⇒ Boolean
54 |
# File 'lib/moby/parts_of_speech.rb', line 54 def nominative?(word); pos?(word, :nominative); end |
#nominatives ⇒ Object
24 |
# File 'lib/moby/parts_of_speech.rb', line 24 def nominatives; words(:nominatives); end |
#noun?(word) ⇒ Boolean
Query methods
43 |
# File 'lib/moby/parts_of_speech.rb', line 43 def noun?(word); pos?(word, :noun); end |
#noun_phrase?(word) ⇒ Boolean
45 |
# File 'lib/moby/parts_of_speech.rb', line 45 def noun_phrase?(word); pos?(word, :noun_phrase); end |
#noun_phrases ⇒ Object
15 |
# File 'lib/moby/parts_of_speech.rb', line 15 def noun_phrases; words(:noun_phrase); end |
#nouns ⇒ Object
Word list methods
13 |
# File 'lib/moby/parts_of_speech.rb', line 13 def nouns; words(:noun); end |
#plural?(word) ⇒ Boolean
44 |
# File 'lib/moby/parts_of_speech.rb', line 44 def plural?(word); pos?(word, :plural); end |
#plurals ⇒ Object
14 |
# File 'lib/moby/parts_of_speech.rb', line 14 def plurals; words(:plural) end |
#preposition?(word) ⇒ Boolean
49 |
# File 'lib/moby/parts_of_speech.rb', line 49 def preposition?(word); pos?(word, :preposition); end |
#prepositions ⇒ Object
19 |
# File 'lib/moby/parts_of_speech.rb', line 19 def prepositions; words(:preposition); end |
#pronoun?(word) ⇒ Boolean
51 |
# File 'lib/moby/parts_of_speech.rb', line 51 def pronoun?(word); pos?(word, :pronoun); end |
#pronouns ⇒ Object
21 |
# File 'lib/moby/parts_of_speech.rb', line 21 def pronouns; words(:pronoun); end |
#verb?(word, options = {:type => :all}) ⇒ Boolean
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/moby/parts_of_speech.rb', line 56 def verb?(word, = {:type => :all}) case [:type] when :all pos?(word, :verb_usu_participle) || pos?(word, :verb_transitive) || pos?(word, :verb_intransitive) when :usu pos?(word, :verb_usu_participle) when :transitive pos?(word, :verb_transitive) when :intransitive pos?(word, :verb_intransitive) end end |
#verbs(options = {:type => :all}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/moby/parts_of_speech.rb', line 26 def verbs( = {:type => :all}) case [:type] when :all words(:verb_usu_participle) + words(:verb_transitive) + words(:verb_intransitive) when :usu words(:verb_usu_participle) when :transitive words(:verb_transitive) when :intransitive words(:verb_intransitive) end end |