小编Ala*_*ira的帖子

使用parseString时pyparsing.ParseException(searchString有效)

我正在尝试使用pyparsing解析一些交通违规句子,当我使用grammar.searchString(sentence)它是可以的,但是当我使用parseStringa时ParseException 被抛出.任何人都可以帮我,请说我的代码出了什么问题?

from pyparsing import Or, Literal, oneOf, OneOrMore, nums, alphas, Regex, Word, \
    SkipTo, LineEnd, originalTextFor, Optional, ZeroOrMore, Keyword, Group
import pyparsing as pp

from nltk.tag import pos_tag

sentences = ['Failure to control vehicle speed on highway to avoid collision','Failure to stop at stop sign', 'Introducing additives into special fuel by unauthorized person and contrary to regulations', 'driver fail to stop at yield sign at nearest pointf approaching traffic view when req. for safety', …
Run Code Online (Sandbox Code Playgroud)

python grammar nlp nltk pyparsing

5
推荐指数
1
解决办法
440
查看次数

标签 统计

grammar ×1

nlp ×1

nltk ×1

pyparsing ×1

python ×1