すべての文字列に特殊な単語が含まれているかどうかを解析するプログラムを作成しようとしています。私は、次のコードを書いたが、それが動作していません。pyparsing:特別な単語を含む文を構文解析する
from pyparsing import *
word = Word(alphas)
sentence = OneOrMore(word)
day = Literal("day")
sentence_end_with_happy = sentence + day + sentence
ret = sentence_end_with_happy.parseString("hi this is a nice day and everything is ok")
私は特別な言葉「日」との文章を解析しようとしたが、解析中に、それはエラーを持っている...
pyparsing.ParseException:期待します(行1、col 43)
ルール... –