Simile的无上下文语法

时间:2017-04-06 01:50:31

标签: python nlp context-free-grammar opennlp

我正在开发一个项目,需要帮助为Simile构建一个无上下文语法(词性)。如果有人能告诉我从哪里开始或给我一些提示!

完成的工作

用于检查明喻的语法

grammar = CFG.fromstring("""
S -> NP "like" NP | "JJ" "like" "NP" | NP V "like" NP | "EX" "like" "NN" | NP "as" "JJ" "as" NP | V "as" "JJ" "as" NP | "as" NP "as"| OTH
NP -> N | "JJ" N | "DT" NP | "NNS" N
N -> "NNP" | "PRP" | "NN"
V -> "VBD" | "VB" | "VBG"
OTH -> "OTH" "PUNC" "FW" "WDT" "TO" "RB" "VBD" "VBG"  "LS" "VBN" "NN" "IN" "S" "EX" "VB" "CC" "UH" "PRP" "MD" 
""") 

这是用蛮力方法制作的,

0 个答案:

没有答案