From: Adam Prescott Date: 2011-03-01T20:02:13+09:00 Subject: Re: Automatic question generator libs in Ruby Language --e0cb4e6ff3655cf406049d69b8df Content-Type: text/plain; charset=UTF-8 On Tue, Mar 1, 2011 at 10:55 AM, Peter Zotov wrote: > > def questions(para) > para.scan(/([^!.]+?\?|.+?[!.])\w*/m).flatten.select { |m| m[-1] == ?? > }.map &:strip > end > > ruby-1.9.2-p136 :063 > str > => "This is a sentence? Yes. And this too? Definitely!\n" > ruby-1.9.2-p136 :064 > questions(str) > => ["This is a sentence?", "And this too?"] > > This could be a long rabbit hole. questions("What does '?' mean?") #=> ["What does '?", "' mean?"] --e0cb4e6ff3655cf406049d69b8df--