||
nltk grammar中的函数
| productions(self, lhs=None, rhs=None, empty=False)
| Return the grammar productions, filtered by the left-hand side
| or the first item in the right-hand side.
| 默认返回左右语法符号一一对应的列表,
比如 NP -> Det N | PP, 处理后: [NP -> Det N, NP -> Det NPP],注意语法的表示结构。
| :param lhs: Only return productions with the given left-hand side. 返回右边为某特定值的语法,比如: V -> 'shoot' 左边为V,返回整个
| :param rhs: Only return productions with the given first item 返回右边为特定值的
| in the right-hand side.
| :param empty: Only return productions with an empty right-hand side.
| :return: A list of productions matching the given constraints. 返回符合条件的内容全部语法结构 列表
| :rtype: list(Production)
左右实际含义如同 productions[i].lhs()
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-7-18 18:34
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社