Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prioritized list of RGL functions, for implementors #238

Open
heatherleaf opened this issue May 14, 2019 · 6 comments
Open

Prioritized list of RGL functions, for implementors #238

heatherleaf opened this issue May 14, 2019 · 6 comments

Comments

@heatherleaf
Copy link
Member

Not all RGL functions are equally important, e.g. DetCN is much more important to implement than PPartNP. It would be good with a prioritised list of functions, so that new language implementors know where to start and then continue.

The MiniRGL is of course similar to this, but I think that it would be good with a more fine-grained list covering all RGL functions.

@heatherleaf
Copy link
Member Author

heatherleaf commented May 14, 2019

Here is a suggestion of such a list (not including all RGL files), with 4 different priorities (+++, ++, +, -). I'm sure that the priorities can be discussed, and I don't think my suggestions here are the best ones.

The functions are grouped by file and then by result category (so that all functions creating NPs are grouped together).

///////////////////////////////////////////////////////////////////////////////
// Noun.gf

+++ DetCN    : Det -> CN -> NP ;   -- the man
+++ UsePN    : PN -> NP ;          -- John
+++ UsePron  : Pron -> NP ;        -- he
++ AdvNP    : NP -> Adv -> NP ;    -- Paris today
++ MassNP   : CN -> NP ;            -- (beer)
+ PredetNP : Predet -> NP -> NP ; -- only the man 
+ DetNP    : Det -> NP ;  -- these five
+ PPartNP  : NP -> V2  -> NP ;    -- the man seen
- RelNP    : NP -> RS  -> NP ;    -- Paris, which is here
- CountNP  : Det -> NP -> NP ;    -- three of them, some of the boys

+++ DetQuant    : Quant -> Num ->        Det ;  -- these five
++ DetQuantOrd : Quant -> Num -> Ord -> Det ;  -- these five best

+++ NumSg   : Num ;  -- [no numeral, but marked as singular]
+++ NumPl   : Num ;  -- [no numeral, but marked as plural]
+++ NumCard : Card -> Num ; -- one/five [explicit numeral]

+++ NumNumeral : Numeral -> Card ;  -- fifty-one
+ NumDigits  : Digits  -> Card ;  -- 51
+ AdNum      : AdN -> Card -> Card ;   -- almost 51

+++ OrdNumeral : Numeral -> Ord ;  -- fifty-first
++ OrdSuperl  : A       -> Ord ;  -- warmest
+ OrdDigits  : Digits  -> Ord ;  -- 51st
+ OrdNumeralSuperl : Numeral -> A -> Ord ; -- third largest

+++ IndefArt   : Quant ;  -- a/an
+++ DefArt     : Quant ;  -- the
++ PossPron   : Pron -> Quant ;    -- my (house)

+++ UseN : N -> CN ;              -- house
+++ AdjCN   : AP -> CN  -> CN ;   -- big house
++ AdvCN   : CN -> Adv -> CN ;   -- house on the hill
++ RelCN   : CN -> RS  -> CN ;   -- house that John bought
+ ApposCN : CN -> NP -> CN ;    -- city Paris (, numbers x and y)
+ SentCN  : CN -> SC  -> CN ;   -- question where she sleeps
+ PossNP  : CN -> NP -> CN ;     -- house of Paris, house of mine
+ PartNP  : CN -> NP -> CN ;     -- glass of wine
- ComplN2 : N2 -> NP -> CN ;    -- mother of the king
- UseN2   : N2 -> CN ;          -- mother

- ComplN3 : N3 -> NP -> N2 ;    -- distance from this city (to Paris)
- Use2N3  : N3 -> N2 ;          -- distance (from this city)
- Use3N3  : N3 -> N2 ;          -- distance (to Paris)

- AdjDAP : DAP -> AP -> DAP ;    -- the large (one)
- DetDAP : Det -> DAP ;          -- this (or that) 

///////////////////////////////////////////////////////////////////////////////
// Verb.gf

+++ UseV     : V   -> VP ;        -- sleep
+++ UseComp  : Comp -> VP ;            -- be warm
+++ ComplSlash : VPSlash -> NP -> VP ; -- love it
++ ComplVV  : VV  -> VP -> VP ;  -- want to run
++ AdvVP    : VP -> Adv -> VP ;        -- sleep here
++ AdVVP    : AdV -> VP -> VP ;        -- always sleep
+ ComplVS  : VS  -> S  -> VP ;  -- say that she runs
+ ComplVQ  : VQ  -> QS -> VP ;  -- wonder who runs
+ ComplVA  : VA  -> AP -> VP ;  -- they become red
+ ReflVP   : VPSlash -> VP ;         -- love himself
- UseCopula : VP ;                    -- be
- PassV2   : V2 -> VP ;               -- be loved
- ExtAdvVP : VP -> Adv -> VP ;        -- sleep , even though ...

+++ SlashV2a : V2        -> VPSlash ;  -- love (it)
++ Slash2V3 : V3  -> NP -> VPSlash ;  -- give it (to her)
++ Slash3V3 : V3  -> NP -> VPSlash ;  -- give (it) to her
++ SlashVV    : VV  -> VPSlash -> VPSlash ;       -- want to buy
+ SlashV2V : V2V -> VP -> VPSlash ;  -- beg (her) to go
+ SlashV2S : V2S -> S  -> VPSlash ;  -- answer (to him) that it is good
+ SlashV2Q : V2Q -> QS -> VPSlash ;  -- ask (him) who came
+ SlashV2A : V2A -> AP -> VPSlash ;  -- paint (it) red
+ SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
+ AdvVPSlash : VPSlash -> Adv -> VPSlash ;  -- use (it) here
+ AdVVPSlash : AdV -> VPSlash -> VPSlash ;  -- always use (it)
- VPSlashPrep : VP -> Prep -> VPSlash ;  -- live in (it)

+++ CompAP   : AP  -> Comp ;            -- (be) small
+++ CompNP   : NP  -> Comp ;            -- (be) the man
+++ CompAdv  : Adv -> Comp ;            -- (be) here
+ CompCN   : CN  -> Comp ;            -- (be) a man/men

///////////////////////////////////////////////////////////////////////////////
// Adjective.gf

+++ PositA  : A  -> AP ;        -- warm
+++ AdjOrd  : Ord -> AP ;       -- warmest
+++ UseComparA : A  -> AP ;     -- warmer
++ AdAP    : AdA -> AP -> AP ; -- very warm
+ AdvAP   : AP -> Adv -> AP ; -- warm by nature
+ ComparA : A  -> NP -> AP ;  -- warmer than I
+ CAdvAP  : CAdv -> AP -> NP -> AP ; -- as cool as John
- ComplA2 : A2 -> NP -> AP ;  -- married to her
- ReflA2  : A2 -> AP ;        -- married to itself
- UseA2   : A2 -> AP ;        -- married
- SentAP  : AP -> SC -> AP ;  -- good that she is here

///////////////////////////////////////////////////////////////////////////////
// Adverb.gf

+++ PrepNP      : Prep -> NP -> Adv ;        -- in the house
++ PositAdvAdj : A -> Adv ;                 -- warmly
++ AdAdv  : AdA -> Adv -> Adv ;             -- very quickly
+ SubjS  : Subj -> S -> Adv ;              -- when she sleeps
- ComparAdvAdj  : CAdv -> A -> NP -> Adv ; -- more warmly than John
- ComparAdvAdjS : CAdv -> A -> S  -> Adv ; -- more warmly than he runs

+ PositAdAAdj : A -> AdA ;                 -- extremely

+ AdnCAdv : CAdv -> AdN ;                  -- less (than five)

///////////////////////////////////////////////////////////////////////////////
// Conjunction.gf

++ ConjS    : Conj -> ListS -> S ;       -- he walks and she runs
++ BaseS : S -> S -> ListS ;      -- John walks, Mary runs
++ ConsS : S -> ListS -> ListS ;  -- John walks, Mary runs, Bill swims

++ ConjAP   : Conj -> ListAP -> AP ;     -- cold and warm
++ BaseAP : AP -> AP -> ListAP ;       -- red, white
++ ConsAP : AP -> ListAP -> ListAP ;   -- red, white, blue

++ ConjNP   : Conj -> ListNP -> NP ;     -- she or we
++ BaseNP : NP -> NP -> ListNP ;      -- John, Mary
++ ConsNP : NP -> ListNP -> ListNP ;  -- John, Mary, Bill

+ ConjCN   : Conj -> ListCN -> CN ;     -- man and woman
+ BaseCN : CN -> CN -> ListCN ;      -- man, woman
+ ConsCN : CN -> ListCN -> ListCN ;  -- man, woman, child

+ ConjAdv  : Conj -> ListAdv -> Adv ;   -- here or there
+ BaseAdv : Adv -> Adv -> ListAdv ;     -- here, there
+ ConsAdv : Adv -> ListAdv -> ListAdv ; -- here, there, everywhere

+ ConjAdV  : Conj -> ListAdV -> AdV ;   -- always or sometimes
+ BaseAdV : AdV -> AdV -> ListAdV ;     -- always, sometimes
+ ConsAdV : AdV -> ListAdV -> ListAdV ; -- always, sometimes, never

- ConjIAdv : Conj -> ListIAdv -> IAdv ; -- where and with whom
- BaseIAdv : IAdv -> IAdv -> ListIAdv ;     -- where, when
- ConsIAdv : IAdv -> ListIAdv -> ListIAdv ; -- where, when, why

- ConjRS   : Conj -> ListRS -> RS ;     -- who walks and whose mother runs
- BaseRS : RS -> RS -> ListRS ;       -- who walks, whom I know
- ConsRS : RS -> ListRS -> ListRS ;   -- who wals, whom I know, who is here

- ConjDet  : Conj -> ListDAP -> Det ;   -- his or her
- BaseDAP : DAP -> DAP -> ListDAP ; 
- ConsDAP : DAP -> ListDAP -> ListDAP ; 

///////////////////////////////////////////////////////////////////////////////
// Relative.gf

+++ RelVP    : RP -> VP -> RCl ;      -- who loves John
++ RelSlash : RP -> ClSlash -> RCl ; -- whom John loves
+ RelCl    : Cl -> RCl ;            -- such that John loves her

+++ IdRP  : RP ;                      -- which
- FunRP : Prep -> NP -> RP -> RP ;  -- the mother of whom

///////////////////////////////////////////////////////////////////////////////
// Sentence.gf

+++ PredVP    : NP -> VP -> Cl ;         -- John walks
+ PredSCVP  : SC -> VP -> Cl ;         -- that she goes is good

++ SlashVP   : NP -> VPSlash -> ClSlash ;      -- (whom) he sees
+ AdvSlash  : ClSlash -> Adv -> ClSlash ;     -- (whom) he sees today
+ SlashPrep : Cl -> Prep -> ClSlash ;         -- (with whom) he walks 
- SlashVS   : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves

++ ImpVP     : VP -> Imp ;              -- love yourselves

++ EmbedVP   : VP -> SC ;               -- to go
+ EmbedS    : S  -> SC ;               -- that she goes
- EmbedQS   : QS -> SC ;               -- who goes

+++ UseCl    : Temp -> Pol -> Cl  -> S ;   -- she had not slept
+ AdvS     : Adv -> S  -> S ;            -- then I will go home
+ RelS     : S -> RS -> S ;              -- she sleeps, which is good
+ SSubjS    : S -> Subj -> S -> S ;       -- I go home, if she comes
- ExtAdvS  : Adv -> S  -> S ;            -- next week, I will go home

+++ UseQCl   : Temp -> Pol -> QCl -> QS ;  -- who had not slept

++ UseRCl   : Temp -> Pol -> RCl -> RS ;  -- that had not slept

+ UseSlash : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen

///////////////////////////////////////////////////////////////////////////////
// Question.gf

+++ QuestCl     : Cl -> QCl ;            -- does John walk
+++ QuestVP     : IP -> VP -> QCl ;      -- who walks
++ QuestSlash  : IP -> ClSlash -> QCl ; -- whom does John love
++ QuestIAdv   : IAdv -> Cl -> QCl ;    -- why does John walk
++ QuestIComp  : IComp -> NP -> QCl ;   -- where is John
+ QuestQVP      : IP -> QVP -> QCl ;       -- who buys what where

+ IdetCN    : IDet -> CN -> IP ;       -- which five songs
- IdetIP    : IDet       -> IP ;       -- which five
- AdvIP     : IP -> Adv -> IP ;        -- who in Paris

- IdetQuant : IQuant -> Num -> IDet ;  -- which (five)

+ PrepIP    : Prep -> IP -> IAdv ;     -- with whom
- AdvIAdv   : IAdv -> Adv -> IAdv ;    -- where in Paris

++ CompIAdv  : IAdv -> IComp ;          -- where (is it)
++ CompIP    : IP   -> IComp ;          -- who (is it)

+ ComplSlashIP  : VPSlash -> IP -> QVP ;   -- buys what 
+ AdvQVP        : VP  ->   IAdv -> QVP ;   -- lives where 
- AddAdvQVP     : QVP ->   IAdv -> QVP ;   -- buys what where 

///////////////////////////////////////////////////////////////////////////////
// Phrase.gf

+++ PhrUtt   : PConj -> Utt -> Voc -> Phr ; -- but come here, my friend

+++ UttS      : S   -> Utt ;                -- John walks
+++ UttQS     : QS  -> Utt ;                -- is it good
++ UttImpSg  : Pol -> Imp -> Utt ;         -- (don't) love yourself
++ UttImpPl  : Pol -> Imp -> Utt ;         -- (don't) love yourselves
++ UttNP     : NP   -> Utt ;               -- this man
+ UttImpPol : Pol -> Imp -> Utt ;         -- (don't) sleep (polite)
+ UttAdv    : Adv  -> Utt ;               -- here
+ UttVP     : VP   -> Utt ;               -- to sleep
+ UttAP     : AP   -> Utt ;               -- fine
- UttIP     : IP   -> Utt ;               -- who
- UttIAdv   : IAdv -> Utt ;               -- why
- UttCN     : CN   -> Utt ;               -- house
- UttCard   : Card -> Utt ;               -- five
- UttInterj : Interj -> Utt ;             -- alas

+++ NoPConj   : PConj ;                     -- [plain phrase without conjunction in front]
- PConjConj : Conj -> PConj ;             -- and

+++ NoVoc   : Voc ;                         -- [plain phrase without vocative]
- VocNP   : NP -> Voc ;                   -- my friend

///////////////////////////////////////////////////////////////////////////////
// Numeral.gf

++ num : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
++ n2, n3, n4, n5, n6, n7, n8, n9 : Digit ;
++ pot01 : Sub10 ;                               -- 1
++ pot0 : Digit -> Sub10 ;                       -- d * 1
++ pot110 : Sub100 ;                             -- 10
++ pot111 : Sub100 ;                             -- 11
++ pot1to19 : Digit -> Sub100 ;                  -- 10 + d
++ pot0as1 : Sub10 -> Sub100 ;                   -- coercion of 1..9
++ pot1 : Digit -> Sub100 ;                      -- d * 10
++ pot1plus : Digit -> Sub10 -> Sub100 ;         -- d * 10 + n
++ pot1as2 : Sub100 -> Sub1000 ;                 -- coercion of 1..99
++ pot2 : Sub10 -> Sub1000 ;                     -- m * 100
+ pot2plus : Sub10 -> Sub100 -> Sub1000 ;       -- m * 100 + n
++ pot2as3 : Sub1000 -> Sub1000000 ;             -- coercion of 1..999
+ pot3 : Sub1000 -> Sub1000000 ;                -- m * 1000
+ pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
- IDig  : Dig -> Digits ;       -- 8
- IIDig : Dig -> Digits -> Digits ; -- 876
- D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig ;

///////////////////////////////////////////////////////////////////////////////
// Idiom.gf

++ ImpersCl  : VP -> Cl ;        -- it is hot
++ ExistNP   : NP -> Cl ;        -- there is a house
+ GenericCl : VP -> Cl ;        -- one sleeps
+ CleftNP   : NP  -> RS -> Cl ; -- it is I who did it
+ CleftAdv  : Adv -> S  -> Cl ; -- it is here she slept
+ ExistIP   : IP -> QCl ;       -- which houses are there
+ ExistNPAdv : NP -> Adv -> Cl ;    -- there is a house in Paris
+ ExistIPAdv : IP -> Adv -> QCl ;   -- which houses are there in Paris
- ProgrVP   : VP -> VP ;        -- be sleeping
- ImpPl1    : VP -> Utt ;       -- let's go
- ImpP3     : NP -> VP -> Utt ; -- let John walk
- SelfAdvVP : VP -> VP ;        -- is at home himself
- SelfAdVVP : VP -> VP ;        -- is himself at home
- SelfNP    : NP -> NP ;        -- the president himself (is at home)

///////////////////////////////////////////////////////////////////////////////
// Tense.gf

+++ TTAnt : Tense -> Ant -> Temp ;  -- [combination of tense and anteriority, e.g. past anterior]
+++ PPos : Pol ;           -- I sleep  [positive polarity]
+++ PNeg : Pol ;           -- I don't sleep [negative polarity]
+++ TPres  : Tense ;             -- I sleep/have slept [present]  
+++ ASimul : Ant ;               -- I sleep/slept [simultaneous, not compound]
+++ TPast  : Tense ;             -- I slept [past, "imperfect"]      --# notpresent
+++ TFut   : Tense ;             -- I will sleep [future] --# notpresent
+++ TCond  : Tense ;             -- I would sleep [conditional] --# notpresent
+++ AAnter : Ant ;               -- I have slept/had slept [anterior, "compound", "perfect"] --# notpresent

///////////////////////////////////////////////////////////////////////////////
// Text.gf

- TEmpty     : Text ;                 -- [empty text, no sentences]
- TFullStop  : Phr -> Text -> Text ;  -- John walks. ...
- TQuestMark : Phr -> Text -> Text ;  -- Are they here? ...
- TExclMark  : Phr -> Text -> Text ;  -- Let's go! ...

@inariksit
Copy link
Member

This is a good idea, and on the first look I agree with your judgments.

Quick remark: you have +++ for NumNumeral and OrdNumeral, but only ++ and + for anything that builds a Numeral.

@aarneranta
Copy link
Contributor

Here is a frequency list of RGL functions in the Penn treebank. Starting with the top-n ones might not be all wrong.

One should of course not abandon Peter's rational approach, but rather combine it with this empirical approach. The first thing to look is how well they agree.

rgl-penn-freqs.txt

@johnjcamilleri
Copy link
Member

Great initiative @heatherleaf!
Another relevant question is where should this information live? Current options I see:

  1. The RGL synopsis page.
  2. A new subpage linked to from the synopsis, much like the RGL status page.
  3. We convert the "LREC" RG tutorial from PDF into a proper web page, and add this information there.

I'm willing to take care of 3 if you agree that it could be valuable to have a living RG tutorial page.

@heatherleaf
Copy link
Member Author

Some thoughts by @krangelov, from the GF mailing list:

I think the frequencies are just the first guideline. The functions should be grouped in sets. I would start with UseN, DetQuant, IndefArt/DefArt, NumSg/NumPl, DetCN. This would let me to build simple noun phrases. All these functions are at the top of the list but not in exactly this order.

After that I would do UseV and PredVP. These two will add the capability to build simple VPs and simple sentences.

Probably next, I will add PositA and AdjCN.

Building the grammar in that order makes the development more interesting by gradually exploring the RGL without digging too deep.

@heatherleaf
Copy link
Member Author

Reflections by @aarneranta, from the GF mailing list:

ComplSlash and SlashV2a are also important. With them, the grammarian has to decide about (1) the S-V-O order (2) the NP cases that are needed.

In the different versions of Mini resource, I have merged them to ComplV2, since the VPSlash category can be hard to grasp in the beginning. But one might question this.

The Mini resource that I would currently recommend is the one for the latest summer school, also used at my on-going course in Gothenburg.

https://github.com/GrammaticalFramework/gf-summerschool-2018/tree/master/resource

The functions in abstract/MiniGrammar.gf are grouped following the module structure of the full RGL, corresponding to what Krasimir suggests.

Chapter 9 of the GF book should still work as a tutorial and documentation for how to get started.

inariksit added a commit that referenced this issue Aug 25, 2023
Also addressing this #238 with a README that adds a suggested implementation order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants