Menu

Problems with OpenCCG's grammar

Help
Zhao Meng
2016-07-10
2016-07-11
  • Zhao Meng

    Zhao Meng - 2016-07-10

    I'm learning OpenCCG and I encountered a problem when I tried to use ccg2xml:

    $ ccg2xml tinytiny.ccg
    ccg2xml: Processing tinytiny.ccg
    Error, line 15: Syntax error at '{'
    Errors during compilation, files not output.
    

    I followed the tutorial on VisCCG Tutorial and had the following code:

    ############ [name of the grammar] ####################
    #
    ## xxxx
    ## xxxx
    #
    #
    # For help on how to create grammars with VisCCG, see the tutorial:
    #   http://comp.ling.utexas.edu/wiki/doku.php/openccg/ccggui_tut
    
    ####################### Features #######################
    
    feature {
      case<2>: nom acc;
      num<2>: sg pl;
      pers<2>: {1st 2nd} 3rd;
      tense<E>: past pres;
      sem-num<X>: sg-X pl-X;
    
      ontology: sem-obj {
         phys-obj {
            animate-being {person animal}
            thing
           }
         situation {
            change {action}
            state
           }
        };
    }
    
    ######################### Words #########################
    word the:Det;
    word a:Det: sg;
    word policeman:N(person): sg 3rd;
    word policemen:N(person): pl 3rd;
    word sleep:IntransV: pres non-3rd sg;
    word sleep:IntransV: pres pl;
    word sleeps:IntransV: pres 3rd sg;
    word slept:IntransV: past;
    
    ######################### Rules #########################
    
    ################## Lexicon/Categories ####################
    family IntransV(V) {
      entry: s<1> [E] \ np<2> [X nom] : E:action(* <Actor>X:animate-being);
    }
    family N {
      entry: n<2>[X]: X:sem-obj(*);
    }
    family Det(indexRel="det") {
      entry: np<2> [X pers=3rd] /^ n<2> [X]: X:sem-obj(<det>*);
    }
    
    ####################### Testbed #########################
    testbed {
      the policeman sleeps: 1;
      the policemen sleeps: 0;
      the policemen sleep: 1;
      the policeman sleeps the peach: 0;
    }
    
     

    Last edit: Zhao Meng 2016-07-11
  • Michael White

    Michael White - 2016-07-11

    Yes, not the most informative error message. The problem is that you're specifying that 1st and 2nd person are subtypes but not what they should be subtypes of. If you add non-3rd at the beginning of the person feature spec, as shown below, this works.

      pers<2>: non-3rd {1st 2nd} 3rd;
    

    The distribution comes with a similar tinytiny.ccg file in ccg-format-grammars; you can use this as an example to compare to what you've come up.

     

Log in to post a comment.