问题描述
我想编写一个代码,它获取文本并从中提取信息以了解例如一个“农民”是。它应该记住例如有以下问题/答案的“农民”:
谁?答案:一个人
什么?答案:植物蔬菜
为什么?答:因为他想赚钱
是否有现有的图书馆,实施了这样的问答系统?最好在 C++ 中?唯一与此类似的描述如下(但它忽略了“谁?”、“什么?”、“为什么?”问题的方案。
# This grammar is from Allison Parrish
# https://github.com/aparrish/rwet-examples
# clauses
S -> NP VP
S -> Interj NP VP
NP -> Det N
NP -> Det N that VP
NP -> Det Adj N
VP -> Vtrans NP # transitive verbs have direct objects
VP -> Vintr # intransitive verbs have no direct object
# terminals
Interj -> oh,| my,| wow,| damn,Det -> this | that | the
N -> amoeba | dichotomy | seagull | trombone | corsage | restaurant | suburb
Adj -> bald | smug | important | tame | overstaffed | luxurIoUs | blue
Vtrans -> computes | examines | foregrounds | prefers | interprets | spins
Vintr -> coughs | daydreams | whines | slobbers | vocalizes | sneezes ```
from: https://github.com/shiffman/A2Z-F16/blob/gh-pages/week8-cfg/02_cfg_reader/test.grammar
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)