Search code examples
gf

The relative clause (which) in GF


"Play Toy Story which was published last year"

Sentence = mkUtt( mkImp (mkVP
                (mkV2 "play")
                (mkNP (mkCN 
                    (mkCN (mkN "Toy Story"))
                    (mkS pastTense simultaneousAnt(mkCl (mkVP 
                        (mkV2 "publish")
                        (mkNP (mkCN (mkN "last yser")))
                        )))
                    ))
        ));

When creating a relative clause sentence in GF it always the syntax S for sentence will add that between the two of the sentences is there is any way to replace that with which.


Solution

  • First of all, the structure you made isn't a relative clause, but this structure:

    mkCN : CN -> S -> CN -- rule that she sleeps
    

    Relative clause has the type RS in the RGL.

    How to construct an actual RS

    Here I build the RS gradually. Feel free to put these steps back to a single expression, if you wish so, but I find it clearer to to things like this.

    oper
      last_year_Adv : Adv = ParadigmsEng.mkAdv "last year" ;
    
      published_last_year_VP : VP = mkVP (passiveVP (mkV2 "publish")) last_year_Adv ;
    
      which_is_published_last_year_RCl : RCl = mkRCl which_RP published_last_year_VP ;
    
      which_was_published_last_year_RS : RS = mkRS pastTense which_is_published_last_year_RCl ;
    
    lin
      play_TS = mkUtt (mkImp (mkVP
                                (mkV2 "play")
                                (mkNP
                                   (mkNP (mkPN "Toy Story"))
                                   which_was_published_last_year_RS)
                             )
                      ) ;
    

    Now when we test it on the GF shell, we see that despite the name, which_RP is actually "that".

    > l play_TS 
    play Toy Story , that was published last year
    

    How to change "that" into "which"

    The first thing to check when you want to create a new lexical item is Paradigms module. Unfortunately, there is no mkRP for English. Things like relative pronouns are usually thought of as closed class: there's only a small, fixed amount of them. Other examples of closed classes are basic numerals (you can't just make up a new integer between 4 and 5!) and determiners. Contrast this to open classes like nouns, verbs and adjectives, those pop up all the time. For open classes, Paradigms modules have many options. But not for closed classes, like relative pronouns.

    So if Paradigms doesn't help, the next thing to check is the language-specific Extra module.

    Check language-specific Extra modules

    If you have the RGL source on your own computer, you can just go to the directory gf-rgl/src/english and grep for which. Or you can use the RGL browser to search for interesting functions.

    Instructions how to use RGL source browser

    And there is indeed a relative pronoun in ExtraEng, also called which_RP. (There is also one called who_which_RP.) So now you can do these modifications in your grammar:

    concrete MyGrammarEng of MyGrammar = 
      open SyntaxEng, 
           ParadigmsEng, 
           ExtraEng -- Need to open ExtraEng in the concrete!
        in ** {
    
    -- … as usual, except for
    
    oper
     which_is_published_last_year_RCl : RCl = 
       mkRCl ExtraEng.which_RP -- Use the ExtraEng.which_RP!
             published_last_year_VP ;
    

    And the rest of the code is like before. This produces the result you want.

    > l play_TS 
    play Toy Story , which was published last year
    

    Last-resort hack

    So you have looked in all possible modules and found nothing. Consider making it into an issue in the gf-rgl repository, if it's something that's clearly wrong or missing.

    But in any case, here's a general, unsafe hack to quickly construct what you want.

    First, let's look at the lincat of RP in CatEng, {s : RCase => Str ; a : RAgr}. Then let's look at its implementation in RelativeEng. There you see also the explanation why it's always "that": unlike who and which, "that" works for animate and inanimate NPs.

    So I would do this to force the string "which":

    oper
      myWhich_RP : RP = which_RP ** {s = table {_ => "which"}} ;
    

    The ** syntax means record extension. We use all other fields from the original which_RP, but in the s field, we put a table whose all branches contain the string "which". (You can read more about this technique in my blog.)

    Then we use the newly defined myWhich_RP in forming the relative clause:

    oper
      which_is_published_last_year_RCl : RCl = mkRCl myWhich_RP published_last_year_VP ;
    

    This works too, but it's unsafe, because whenever the RGL changes, any code that touches the raw implementation may break.