qianxun2011的个人博客分享 http://blog.sciencenet.cn/u/qianxun2011

博文

文法分析中的 解析器 productions 函数

已有 2347 次阅读 2015-2-5 20:18 |个人分类:nltk|系统分类:科研笔记

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()




https://blog.sciencenet.cn/blog-629912-865881.html

上一篇:专利分析之难—想知道谁有专利不容易
下一篇:用于统计的哈希
收藏 IP: 114.251.200.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-7-18 18:34

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部