in reply to Recognizing parts of speech

Lingua::LinkParser should be able to get you there.
use Lingua::LinkParser; our $parser = new Lingua::LinkParser; my $sentence = $parser->create_sentence("I am tired and he is hungry." +); my @linkages = $sentence->linkages; foreach $linkage (@linkages) { print ($parser->get_diagram($linkage)); }
Will get you a parse diagram like:
+---------------------Xp--------------------+ | +-------CC-------+ | +--Wd--+-SX-+--Pa-+ +Wdc+-Ss+--Pa--+ | | | | | | | | | | LEFT-WALL I.p am.v tired.a and he is.v hungry.a .
Now the method get_diagram is for human reading but, L::LP does let you at all that programatically. You can determine if each word is a subject, verb, adjective, ... and what it relates to.

besides the docs for L::LP you can you at my module Acme::Yoda for examples.

grep
Mynd you, mønk bites Kan be pretti nasti...

Replies are listed 'Best First'.
Re: Re: Recognizing parts of speech
by CountZero (Bishop) on May 30, 2003 at 06:54 UTC

    Is there no end to the useful modules on CPAN? Soon there will be no more wheels to re-invent!

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      They will combine the exisiting modules in different combination to do more powerful work. Think : Number of Combination of any 2 modules out of 1000 modules, is approximately 500000.

      Said that.. new devices and software will always encourage new modules.

      artist

      Unfortunately, natural language parsing still has a lot of reinventing to do. While this module will work with simple sentences, I can promise you that it will break and give you misinformation frequently with real world texts. I work for a company that specializes in natural language processing and I can tell you that there is NO technology out there that will give 100% accurate NLP results in real world texts, and any one that will get close will not be free. That said, if your texts are fairly structured and use simple sentences, a link parser will probably do okay.


        While this module will work with simple sentences, I can promise you that it will break and give you misinformation frequently with real world texts.
        Any specific suggestions for making it more robust? I'm sure I'm not alone in saying that I would appreciate improvements... :)
        -----------------------
        You are what you think.


      Not so -- there is no limit to what mankind does not know. New wheels will be invented for reinventing.
      -----------------------
      You are what you think.