From: pat eyler Date: 2005-04-05T02:32:14+09:00 Subject: Re: Ruby utilities for part of speech tagging and text categorization Mark, On Apr 4, 2005 9:44 AM, Mark Watson wrote: > Released as Free Software on my open source page at www.markwatson.com. > > I have started using Ruby for some of my research. I wrote these > utilities for my own use, but I hope that other people find them both > useful and fun. Thanks for writing these, I've been interested in using Ruby for some (armchair) text analysis myself. As I read through the tagger.rb script, I saw a lot of non-ruby idiom (not a complaint, just an observation). Before Doing anything else with it, I ran ZenTest (http://rubyforge.org/projects/zentest) against your script and started moving your tests over to Test::Unit. Here's a first shot for you: require 'test/unit' unless defined? $ZENTEST and $ZENTEST require 'tagger' class TestTagger < Test::Unit::TestCase def test_getTags tt = Tagger.new assert_equal(["NN"], tt.getTags("bank")) assert_equal(["DT", "NN", "VBZ", "DT", "JJ", "NN", "JJ", "NN"], tt.getTags("The dog bites the black cat last week.")) assert_equal(["DT", "NN", "VBD", "NNP", "DT", "NN", "JJ", "NN", nil, "PRP", "MD", "NN", "DT", "NN", "RB", "RB"], tt.getTags("The bank gave Sam a loan last week. He can bank an airplane really well.")) assert_equal([],tt.getTags("")) end end I'll be interested in seeing how these projects grow. > > Enjoy! > > -- thanks, -pate ------------------------- We are often unable to tell people what they need to know, because they want to know something else, and would therefore only misunderstand what we said - the Raven (George MacDonald, Lilith)