简体   繁体   English

在这个例子中如何获得第二个最左边的推导?

[英]How to get the second leftmost derivation in this example?

Using the grammar below, my text says that the string "the girl touches the boy with the flower" can be leftmost derived in two ways making the grammar ambiguous.使用下面的语法,我的文本说字符串“the girl touch the boy with the flower”可以通过两种方式在最左边导出,从而使语法变得模糊。 When I try to find the second derivation, I fail.当我试图找到第二个推导时,我失败了。 I really do not see how a second derivation is possible since getting the terminals follows a standard one way pattern: all go from a phrase nonterminal to a couple non-terminals that go to terminals to the terminals.我真的不知道如何进行二次推导,因为获取终端遵循标准的单向模式:所有从短语非终端到几个非终端,再到终端到终端。

Grammar语法

⟨SENTENCE⟩→⟨NOUN-PHRASE⟩⟨VERB-PHRASE⟩ ⟨句子⟩→⟨名词短语⟩⟨动词短语⟩

⟨NOUN-PHRASE⟩→⟨CMPLX-NOUN⟩ | ⟨名词短语⟩→⟨CMPLX-名词⟩ | ⟨CMPLX-NOUN⟩⟨PREP-PHRASE⟩ ⟨CMPLX-名词⟩⟨准备短语⟩

⟨VERB-PHRASE⟩→⟨CMPLX-VERB⟩ | ⟨动词短语⟩→⟨CMPLX-动词⟩ | ⟨CMPLX-VERB⟩⟨PREP-PHRASE⟩ ⟨CMPLX-动词⟩⟨准备短语⟩

⟨PREP-PHRASE⟩→⟨PREP⟩⟨CMPLX-NOUN⟩ ⟨PREP-PHRASE⟩→⟨PREP⟩⟨CMPLX-NOUN⟩

⟨CMPLX-NOUN⟩→⟨ARTICLE⟩⟨NOUN⟩ ⟨CMPLX-NOUN⟩→⟨ARTICLE⟩⟨NOUN⟩

⟨CMPLX-VERB⟩→⟨VERB⟩ | ⟨CMPLX-动词⟩→⟨动词⟩ | ⟨VERB⟩⟨NOUN-PHRASE⟩ ⟨动词⟩⟨名词短语⟩

⟨ARTICLE⟩ → a | ⟨文章⟩ → a | the

⟨NOUN⟩ → boy | ⟨NOUN⟩ → 男孩 | girl |女孩 | flower

⟨VERB⟩ → touches | ⟨动词⟩ → 接触 | likes |喜欢 | sees看到

⟨PREP⟩ → with ⟨PREP⟩ → 与

Below is how I got my first leftmost derivation.下面是我如何得到我的第一个最左边的推导。

Sentence,句子,

Noun-phrase Verb-phrase,名词短语动词短语,

Cmplx-noun Verb-phrase, Cmplx-名词动词短语,

Article Noun Verb-phrase,冠词名词动词短语,

the Noun Verb-phrase,名词动词短语,

the girl Verb-phrase,女孩 动词短语,

the girl Complx-Verb,女孩复合动词,

the girl Verb Noun-phrase,女孩动词名词短语,

the girl touches Noun-phrase,女孩触摸名词短语,

the girl touches Cmplx-noun Prep-phrase,女孩触摸 Cmplx-名词准备短语,

the girl touches Article Noun Prep-phrase,那个女孩触摸了文章名词准备短语,

the girl touches the Noun Prep-phrase,女孩触摸名词准备短语,

the girl touches the boy Prep-phrase,女孩抚摸男孩准备短语,

the girl touches the boy Prep Cmplx-noun,女孩抚摸男孩 Prep Cmplx-名词,

the girl touches the boy with Cmplx-noun,女孩用 Cmplx 名词抚摸男孩,

the girl touches the boy with Article Noun,女孩用冠词接触男孩,

the girl touches the boy with the Noun,女孩用名词接触男孩,

the girl touches the boy with the flower女孩用花抚摸男孩

At

the girl Verb-phrase

Use

⟨VERB-PHRASE⟩→⟨CMPLX-VERB⟩⟨PREP-PHRASE⟩

Then <PREP-PHRASE> will generate "with the flower".然后<PREP-PHRASE>将生成“with the flower”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM