如何在GF中编码带有修饰语的名词,比如“偏移方向”?

huangapple go评论88阅读模式
英文:

How to encode a noun with modifiers like "offset direction" in GF?

问题

我正在使用GF应用语法进行我的第一步。

我想知道如何在GF中编码具有名词修饰词的名词,例如“偏移方向”或“所得税”。

此链接解释了我感兴趣的构造:名词修饰词

我尝试使用mkCN:N -> NP -> CN

mkCN (mkN "offset") (mkNP (mkN "direction"))

这基本上可以工作,但复数形式构造为“offsets direction”而不是“offset directions”。

我在CNNP下找不到其他明显的构造函数。

英文:

I doing my first steps with an GF application grammar.

I wonder how I can encode a noun with noun modifiers like "offset direction" or "income tax" in GF.

This link explains the constructions I am interested in: noun-modifiers

I tried using mkCN : N -> NP -> CN:

mkCN (mkN "offset") (mkNP (mkN "direction"))

which basically works, but the plural is constructed as offsets direction rather than offset directions.

I can't find other obvious constructors under CN or NP.

答案1

得分: 1

替代方案1:直接放入词典(N

最简单的解决方案是从一开始就将它们全部变成名词,如下所示:

lin offset_direction_N = mkN "offset direction";

对于英语来说,在头词之前添加额外的内容是完全可以的,因为模式匹配实际上只涉及到最后部分,所以我们可以得到 fly~fliesboy~boys 等等(对于其他语言的形态学范例通常不成立,但如果你查看它们的范例模块,它们通常有一种处理复合词的特殊方式。如果你的应用中只包含英语,可以忽略所有这些。)

替代方案2:动态创建复合词

是否需要从仅包含单个条目的现有词典中动态构建这些结构?如果是的话,那么 RGL API 没有专门为此目的的函数。

但是,有一个名为 Extend 的模块,其中有一个函数 CompoundN : N -> N -> N

那么如何使用 Extend 模块呢?你一直在使用 RGL API,在打开 Syntax 和 Paradigms 模块时,所有 mkX 操作都是可用的。Extend 模块比核心 RGL 新一些,所以其函数在摘要中没有显示出来。但你可以像使用 Syntax 和 Paradigms 模块一样使用它们。以下是一个示例用法:

resource Test = open ParadigmsEng, ExtendEng in {

  oper
    offset_N : N = mkN "offset";
    direction_N : N = mkN "direction";

    offset_direction_N : N = CompoundN offset_N direction_N ;
}

有关 Extend 模块的更多信息,请参阅 https://inariksit.github.io/gf/2021/02/15/rgl-api-core-extensions.html#extend

英文:

Alternative 1: put them into lexicon (N) directly

The simplest solution is to make them all into nouns from the beginning, as follows:

lin offset_direction_N = mkN "offset direction" ;

For English, the smart paradigms work just fine with extra fluff before the head word, because the pattern matching is really just about the end, so we get fly~flies, boy~boys etc. (This is generally not true of other languages' morphological paradigms, but if you look at their Paradigms modules, they usually have a special way of dealing with compound words. If English is the only language in your application, feel free to ignore all of this.)

Alternative 2: create compounds at runtime

Is there a need to build these constructions on the fly from an existing lexicon that only has single entries? If so, then the RGL API doesn't have a function specifically for that.

However, there is a module called Extend, which has a function CompoundN : N -> N -> N.

So how to use Extend? You have been using the RGL API, where all of the mkX opers are available when you open the Syntax and Paradigms modules. The Extend module is newer than the core RGL, so its functions are not shown in the synopsis. But you can use them just like you'd use the Syntax and Paradigms modules. Here's an example usage:

resource Test = open ParadigmsEng, ExtendEng in {

  oper
    offset_N : N = mkN "offset" ;
    direction_N : N = mkN "direction" ;

    offset_direction_N : N = CompoundN offset_N direction_N ;
}

For more information on the Extend module, see https://inariksit.github.io/gf/2021/02/15/rgl-api-core-extensions.html#extend.

huangapple
  • 本文由 发表于 2023年7月10日 22:02:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76654524.html
  • gf
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定