2

My aim is detecting simple elements in any sentence such as verb, noun or adjective. Is there any gem in Ruby for achieving that? For example:

They elected him president yesterday.

Output:

["subject","verb", "object", "predicative", adverbial"]
Tugkan
  • 183
  • 3
  • 12

2 Answers2

4

These are the only natural language processing options for Ruby that I know of.

Interestingly, they are all by the same person.

EDIT Here is one more option that I found. It's a tutorial on n-gram analysis.

Natural Language Processing with Ruby: n-grams

Dan Grahn
  • 9,044
  • 4
  • 37
  • 74
3

I've used engtagger with good success in the past. It's ported from a Perl program called Lingua::EN::Tagger. It takes a bit of work to get it to do what you want, but I think it's the best tool available for this application (at least at the moment).

max pleaner
  • 26,189
  • 9
  • 66
  • 118
dax
  • 10,779
  • 8
  • 51
  • 86
  • 1
    does it give the elements as array or just with the tags? – Tugkan Nov 14 '13 at 15:06
  • 1
    depends - you can get them as a hash with the frequency as value, but if you fiddle just a bit you could very easily make the output anything you want – dax Nov 14 '13 at 15:12
  • Part-of-Speech tagging is good in engtagger but it's noun phrase method isn't really dependable. – Charlie Egan Nov 08 '14 at 16:00