Fixing your code
Your code doesn't work for a few reasons:
- The return type must be a category, but
verbalN
is an oper. So it should be like compVerbalN : Str -> Str -> N
, or rather compVerbalN : V -> Str -> N
.
- In the body of the function, you use your arguments incorrectly.
- You try to access the
s
field of x
and y
, but according to the type signature, they are strings, not records with a named field.
- You try to give
verbalN
a string as an argument, but actually it expects a V
.
Let's suppose for the sake of practice, that you want to have this type signature, Str -> Str -> N
. Then you need to do something like this:
compVerbalN : Str -> Str -> N = \turning,on ->
let turning_N : N = mkN turning ;
in turning_N ** {
s = \\num,cas => turning_N.s ! num ! cas ++ on
} ;
Testing in the GF shell:
> cc -table compVerbalN "turning" "on"
g . Neutr
s . Sg => Nom => turning on
s . Sg => Gen => turning's on
s . Pl => Nom => turnings on
s . Pl => Gen => turnings' on
This produces the right result, but poking at GF categories' internals like this is risky. The RGL API is fixed, but implementation details of the RGL can always change, like what parameters some table has and what the field names are called. So if it's possible to construct something with only the RGL API, you should do it.
How to do it using the RGL
To construct a particle verb, you need to use the ParadigmsEng constructor partV
, which has the following type signature:
partV : V -> Str -> V -- with particle, e.g. switch + on
If your verb is constructed properly, then verbalN
should produce the correct noun. Here's an example:
resource Test = open SyntaxEng, ParadigmsEng in {
oper
turn_on_V : V = partV (mkV "turn") "on" ;
turning_on_N : N = verbalN turn_on_V ;
}
Testing in GF shell (after i -retain Test.gf
):
> cc -table turning_on_N
g . Neutr
s . Sg => Nom => turning on
s . Sg => Gen => turning's on
s . Pl => Nom => turnings on
s . Pl => Gen => turnings' on
Update your RGL
While answering this question, I noticed that verbalN
didn't originally include the particle, so I added it in a commit just some minutes ago. So in order to see that output, you need to update your RGL.
If it's not possible to update your RGL (e.g. you work on a school computer that you can't install stuff on), then you will need to use a construction like compVerbalN
from the beginning of this answer.