adjective_noun_lex in timeflies.t

Showing 1-2 of 2 messages
adjective_noun_lex in timeflies.t rns 9/9/12 1:23 AM
Does adjective_noun_lex have a specific role in timeflies.t (except making the noun/adjective ambiguity more explicit) and how are symbols of its kind called? I'm tempted to call them "ambigious symbols" or "multisymbols".

The test also passes when fruit banana time arrow flies are passed to alternative() as both noun_lex or adjective_lex and nouns and adjectives are set as adjective_lex and noun_lex in the grammar as shown by the the patch below (the complete file).

In addition, the test can be made to pass when using only "read" and symbols like adjective_noun_lex, see this gist.

Are those just different ways to handle ambiguity in Marpa and can be mixed and matched at will? I'm just fascinated at the opportunities, I have to say.

Thanks in advance.

==cut here==
--- timeflies.t 2012-08-23 06:59:28.000000000 +0300
+++ timeflies-alternative-only.t        2012-09-09 08:58:05.250000000 +0300
@@ -67,10 +67,10 @@
             [ 'sentence', [qw(subject verb adjunct)], 'do_sva_sentence' ],
             [ 'sentence', [qw(subject verb object)],  'do_svo_sentence' ],
             [ 'adjunct',  [qw(preposition object)], 'do_adjunct' ],
-            [ 'adjective',   [qw(adjective_noun_lex)], 'do_adjective' ],
+            [ 'adjective',   [qw(adjective_lex)], 'do_adjective' ],
             [ 'subject',     [qw(adjective noun)], 'do_qualified_subject' ],
             [ 'subject',     [qw(noun)], 'do_bare_subject' ],
-            [ 'noun',        [qw(adjective_noun_lex)], 'do_noun' ],
+            [ 'noun',        [qw(noun_lex)], 'do_noun' ],
             [ 'verb',        [qw(verb_lex)], 'do_verb' ],
             [ 'object',      [qw(article noun)], 'do_object' ],
             [ 'article',     [qw(article_lex)], 'do_article' ],
@@ -92,7 +92,8 @@
 my %lexical_class = (
     'preposition_lex'    => 'like',
     'verb_lex'           => 'like flies',
-    'adjective_noun_lex' => 'fruit banana time arrow flies',
+    'adjective_lex'      => 'fruit banana time arrow flies',
+    'noun_lex'           => 'fruit banana time arrow flies',
     'article_lex'        => 'a an',
 );
 my %vocabulary = ();
@@ -118,7 +119,6 @@

         for my $type ( @{ $vocabulary{$word} } ) {
             $recce->alternative( $type, \$word, 1 )
-                or die 'Recognition failed';
         }
         $recce->earleme_complete();
     } ## end for my $word ( split q{ }, $data )
Re: adjective_noun_lex in timeflies.t Jeffrey Kegler 9/9/12 5:44 PM
Are those just different ways to handle ambiguity in Marpa and can be mixed and matched at will?
Yes, the intent is that both work, and you get your choice of tactics.  The technique involved in lexing the same token as both noun and adjective, I call "ambiguous lexing" and the tokens "ambiguous tokens".  Apparently this terminology was already established in the NLP literature.

-- jeffrey