On Thu, Nov 17, 2016 at 4:55 PM, Ben Goertzel <[email protected]> wrote:

>
>
> > x1 utters verbally/says/phonates/speaks x2.
>
> for each Lojban word.... So he is simply facing the small programming
> task of translating these definitions into sets of English sentences,
> i.e. in the above example
>
> > Now I would like to extract individual sentences from this:
> >
> > x1 utters verbally x2
> > x1 says x2
> > x1 phonates x2
> > x1 speaks x2
>
> This could be done using a fairly simple script but he is wondering if
> there's some elegant parsing framework that could be used to deal with
> the forward-slashes between phrases... I guess ...
>

Well, if it's really just that, then its not "fairly simple", its "almost
trivial".  This kind of string mangling is something that perl excels at.
You can do it in about 7 lines of code. Here:

#! /usr/bin/env perl
while(<>) {      # angle brackets mean "read from standard in"
   ($x1, $v, $x2) = split;   # split on whitespace, into three parts
   @verblist = split /\/, $v;     #split the middle bit, based on slashes
   foreach $verb (@verblist) {   #loop over the list
       print "$x1 $verb $x2";
 }
}

Untested, might have bugs.

--linas

-- 
You received this message because you are subscribed to the Google Groups 
"opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/opencog/CAHrUA37xEnrwM0YZRg%2BxRZdMea%3Dn3syb494N-RvU%2BGWpkTenVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to