I'm trying to use Lingua::LinkParser 1.05. Everything seems to have installed correctly. However when I run the small piece of code shown in perldoc(direct cut and paste - forgive the use strict badness):

use Lingua::LinkParser; our $parser = new Lingua::LinkParser; my $sentence = $parser->create_sentence("This is the turning point."); my @linkages = $parser->linkages; foreach $linkage (@linkages) { print ($parser->get_diagram($linkage)); }

I get the following error:

Can't locate auto/Lingua/LinkParser/linkages.al in @INC @INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at test.pl line 9

Line 9 is my @linkages = $parser->linkages;.Does anyone know why this might be happening? Linkages.al doesn't seem to exist. I've tried running this on two installs of linux. Can anyone else recreate this error? There could be some whacky .al thing I have no idea about...

As an extra - If I change line 9 to my @linkages = $sentence->linkage(1) (as per an example from TPJ) it parses the sentence and shows the diagram as expected.

However my @linkages = $sentence->linkage(1) only parses a limited set of sentences that have 1 (or more) linkages in the sentence. In the case where a word cannot be linked (a null linkage as in "This is so the turning point.") the parser also freaks out with Assertion failed: index out of range because naturally there is a word "so" with a null link.

I cannot stop this error using any of the supplied processing options, e.g.$parser->opts('allow_null') even though this sentence can be parsed using the compiled Link Grammar Parser that Lingua::LinkParser requires. Link Grammar Parser can handle this sentence because it ignores "so" tries to parse the sentence without it.

Basically, I'm stuck with an option that doesn't really give me all the power of Lingua::LinkParser and I want to parse sentences that use "so" and similar null links

Thanks

renster


In reply to Lingua::LinkParser by renster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.