grammar - ANTLR on a noisy data stream Part 2 -
following interesing discussion bart kiers on parsing noisy datastream antlr, i'm ending problem...
the aim still same : extracting useful information following grammar,
verb : 'sleeping' | 'walking'; subject : 'cat'|'dog'|'bird'; indirect_object : 'car'| 'sofa'; : . {skip();}; parse : sentenceparts+ eof ; sentenceparts : subject verb indirect_object ;
a sentence it's 10pm , lazy cat sleeping heavily on sofa in front of tv.
produce following
this perfect , it's doing want.. big sentence, i'm extracting words had sense me.... the, founded following error. if somewhere in text i'm introducing word begin token, i'm ending mismathedtokenexception
or noviableexception
it's 10pm , lazy cat sleeping heavily, doggy bag, on sofa in front of tv.
produce error :
doggy
interpreted beginning dog
part of token subject
, lexer lost... how avoid without defining doggy
special token... have parser understand doggy
word in itself.
well, seems adding any2 :'a'..'z'+ {skip();};
solves problem !
Comments
Post a Comment