Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DT The NP cat VB ate DT a NP rat
- fragment TOKEN : (('A'..'Z') | ('a'..'z'))+;
- fragment WS : (' ' | 't')+;
- WSX : WS;
- DTTOK : ('DT' WS TOKEN);
- NPTOK : ('NP' WS TOKEN);
- nounPhrase: (DTTOK WSX NPTOK);
- chunker : nounPhrase {System.out.println("chunk found "+"("+$nounPhrase+")");};
- WS : (' '|'t')+;
- TOKEN : (('A'..'Z') | ('a'..'z'))+;
- dttok : 'DT' WS TOKEN;
- nntok : 'NN' WS TOKEN;
- nounPhrase : (dttok WS nntok);
- chunker : nounPhrase ;
- chunker : nounPhrase {System.out.println("chunk found "+"("+$nounPhrase.text+")");};
- multiple_names returns [List<Name> names]
- @init {
- names = new ArrayList<Name>(4);
- }
- : a=fullname ' AND ' b=fullname { names.add($a.value); names.add($b.value); };
- multiple_names returns [List<Name> names]
- @init {
- names = new ArrayList<Name>(4);
- }
- : a=fullname ' AND ' b=fullname { names.add($a); names.add($b); };
- public final List<Name> multiple_names() throws RecognitionException {
- List<Name> names = null; // based on "returns" clause of rule definition
- Name a = null; // based on scopes declared in rule definition
- Name b = null; // based on scopes declared in rule definition
- names = new ArrayList<Name>(4); // snippet inserted from `@init` block
- try {
- pushFollow(FOLLOW_fullname_in_multiple_names42);
- a=fullname();
- state._fsp--;
- match(input,189,FOLLOW_189_in_multiple_names44);
- pushFollow(FOLLOW_fullname_in_multiple_names48);
- b=fullname();
- state._fsp--;
- names.add($a); names.add($b);// code inserted from {...} block
- }
- catch (RecognitionException re) {
- reportError(re);
- recover(input,re);
- }
- finally {
- // do for sure before leaving
- }
- return names; // based on "returns" clause of rule definition
- }
- multiple_names returns [List<Name> names]
- @init {
- names = new ArrayList<Name>(4);
- }
- : a=fullname ' AND ' b=fullname { names.add(a); names.add(b); };
Add Comment
Please, Sign In to add comment