Search code examples
gf

Spanish verbs with NP in GF


Running the code below generates sell it to me when using English files from RGL. But changing the library files to Spanish gives this output vende &+ lo me where on the other hand the correct output should be something like this véndeme esto.

concrete TestSpa of Test = open SyntaxSpa,  ParadigmsSpa, IrregSpa, LexiconSpa in {
    
    lincat
        Utterance = Utt;
    lin
        Sentence = mkUtt(mkImp(mkVP
                                sell_V3
                                it_NP
                                i_NP
            ));
}

What is the reason behind this error and how to fix it, thank you!


Solution

  • Yes, imperative forms and clitics in ditransitive constructions are a known issue in RGL's Romance languages, see https://github.com/GrammaticalFramework/gf-rgl/tree/master/src/spanish#known-issues

    There are a couple of solutions:

    Use RGL creatively to get the output you want

    For instance, we notice that the RGL doesn't attach the indirect object into the verb, but we can hack it: let's make the indirect object into direct, and direct into adverb, then we get what we want.

    Sentence =
      let vendeme : VP = mkVP <sell_V3 : V2> i_NP ; -- hack: pretend that i_NP is direct object, to get vendeme. (Unfortunately no é on véndeme.)
          esto : Adv = ParadigmsSpa.mkAdv "esto" ; -- hack: make "esto" into an adverb
       in mkUtt (mkImp (mkVP vendeme esto)) ; -- using mkVP : VP -> Adv -> VP
    

    Testing the output:

    > l Sentence
    vende &+ me esto
    

    Just mentioning for completeness' sake: you can remove the &+ with the flag -bind:

    > l -bind Sentence
    vendeme esto
    

    I know that the accent isn't there, and that's a shame. But most "real-world" uses of GF include using it as a part of some program, not a stand-alone application in the GF shell, and that gives us more opportunities to fix such issues.

    Postprocess the GF output

    The problem is limited to the constructions where the direct and indirect object are both pronouns. If you're using GF from any other application, you can add a postprocessing step.

    I run this command when I have the Spanish resource grammar in a GF shell.

    Lang> gt ImpVP (ComplSlash (Slash3V3 sell_V3 (UsePron ?)) (UsePron ?)) | l
    vende &+ la le
    vende &+ la les
    vende &+ la me
    ...
    vende &+ te nos
    vende &+ te os
    vende &+ te te
    

    This gives you a bunch of strings, all of them wrong. You can write replace rules like s/vende &+ la le/véndesela/ in any other programming language, and then run the GF output through your script.