摘要
给出了上下文无关文法 (context- free grammar,简称 CFG)产生式集的一种划分方法 ,可将产生式分为两类 .使用一类产生式进行推导时 ,推导过程将无限进行下去 ;使用另一类进行推导时 ,推导过程将迅速结束 .证明了 CFG句子生成过程一定是先使用一类产生式使生成的句型不断变长、变复杂 ,再使用另一类产生式使句型变成句子 .据此 ,提出了一种可控制的通用句子生成方法 .其生成一条句子的时间和空间复杂度是 O(r+n) ,其中 n是生成句子的长度或深度限制 ,r是给定上下文无关文法中产生式的数目 .同时 ,给出了适应不同需要的句子生成策略 .
In this paper, a method is presented to partition productions of CFG (context free grammar). It divides production set into two parts. The derivation with productions in one part will never terminate, while it must terminate rapidly with productions in the other part. It is proved that the procedure of generating sentences of CFL (context free language) is using productions in one part to make the sentential form longer and more complex first, and then using productions in the other part to terminate the procedure. A general controllable method is attained for generating sentences of CFL with restricted length or depth. The time and space complexity for generating one sentence is O(r+n) , where n is the restricted length or depth of sentences and r is the number of productions in given CFG. The generating strategies for different conditions are also discussed.
出处
《软件学报》
EI
CSCD
北大核心
2000年第8期1030-1034,共5页
Journal of Software
基金
国家自然科学基金! (No.6 98730 42 )
国家"九五"重点科技攻关项目基金! (No.96 - 72 9- 0 6 - 0 2 )资助
关键词
句子生成
上下无关语言
产生式集划分
随机法
CFG (context free grammar), production set, production set partition, sentence generation, sentence generating strategy.