用GF CountNP Predet

问题描述

我正在尝试使用GF库在GF上生成句子我的一个朋友。 我没有找到正确的方法来构造数字后的前缀,并且无法创建其中一个复数名词的关系。

enter image description here

Noun Phrase类别所示,NumeralDigits之后仅包含Common NounNoun

解决方法

CountNP

Noun模块中有此功能,但是很遗憾,RGL API中没有该功能。该函数为CountNP

CountNP : Det -> NP -> NP ;    -- three of them,some of the boys

要在语法中使用它,您需要打开模块NounEng。通常的做法是打开合格的非API模块:代替N open NounEng in { … },而是open (N=NounEng) in { … }的缩写。然后,在语法正文中,您需要编写N.CountNP。这是一个示例,您可以将其复制并粘贴到名为Friend.gf的文件中。

resource Friend = open SyntaxEng,LexiconEng,(N=NounEng) in {
  oper
    one_Det : Det = mkDet (mkNumeral n1_Unit) ;

    my_friends_NP : NP = mkNP (mkDet i_Pron pluralNum) friend_N ;

    friend : NP = N.CountNP one_Det my_friends_NP ;
}

Predet

有时,当您想修改一个已经存在的NP时,可以使用Predet类别。以下是示例(您可以将它们粘贴到同一文件Friend.gf中)。

-- The RGL includes some Predets,like all,most and only:
all_friends : NP = mkNP all_Predet my_friends_NP ;
most_friends : NP = mkNP most_Predet my_friends_NP ;
only_friends : NP = mkNP only_Predet my_friends_NP ;