2

我有一页故事(即文本数据),我需要对该故事使用贝叶斯网络并对其进行分析。有人能告诉我在R中是否可能吗?如果是,那如何进行?

分析的目标是 - 从叙述文本中提取动作描述。
考虑分析的数据 -

克里希纳对阿朱那的 Dharam-shasthra:

吉塔是克里希纳和阿朱纳在战斗前的对话。克里希纳强调两个术语:业力和佛法。他告诉阿琼这是一场正义的战争;一场佛法之战。佛法是正义之道或制定的一套规则和法律。Kauravas 站在 Adharma 一边,违反了规则和法律,因此 Arjun 必须做他的业力来维护佛法。Arjuna不想战斗。他不明白为什么他必须为一个他甚至不一定想要的王国流血。在他眼里,杀了他的恶,杀了他的家人,是最大的罪过。他放下武器,告诉克里希纳他不会战斗。然后,克里希纳开始了系统的过程来解释为什么它是阿朱那'

克里希纳首先解释了生死轮回。他说没有真正的灵魂死亡,只是在每一轮生死结束时身体的蜕皮。这个循环的目的是让一个人摆脱他们的业力,这些业力是通过一生的行动积累起来的。如果一个人无私地完成了为上帝服务的行为,那么他们就可以消除他们的业力,最终导致灵魂的溶解,获得启蒙和智慧,并结束轮回。如果他们的行为自私,那么他们就会不断积累债务,使他们越来越深地陷入业债。

                                                                            What I want is - post tagger to separate verbs, nouns etc. and then create a meaningful network using that.

在预处理中应遵循的步骤是:

  1. 句法处理(post tagger)
  2. SRL算法(故事人物的语义角色标注)
  3. 会议决议

使用以上所有内容,我需要创建一个知识数据库并创建一个贝叶斯网络。

到目前为止,这是我尝试获取帖子标记器的方法:

txt <- c("As the years went by, they remained isolated in their city. Their numbers increased by freeing women from slavery.
Doom would come to the world in the form of Ares the god of war and the Son of Zeus. Ares was unhappy with the gods as he wanted to prove just how foul his father’s creation was. Hence, he decided to corrupt the mortal men created by Zeus. Fearing his wrath upon the world Zeus decided to create the God killer in order to stop Ares. He then commanded Hippolyta to mould a baby from the sand and clay of the island. Then the five goddesses went back into the Underworld, drawing out the last soul that remained in the Well and giving it incredible powers. The soul was merged with the clay and became flesh. Hippolyta had her daughter and named her Diana, Princess of the Amazons, the first child born on Paradise Island.   
Each of the six members of the  Greek Pantheon granted Diana a gift: Demeter, great strength; Athena, wisdom and courage; Artemis, a hunter's heart and a communion with animals; Aphrodite, beauty and a loving heart; Hestia, sisterhood with fire; Hermes, speed and the power of flight. Diana was also gifted with a sword, the Lasso of truth and the bracelets of penance as weapons to defeat Ares. 
The time arrived when Diana, protector of the Amazons and mankind was sent to the Man's World to defeat Ares and rid the mortal men off his corruption. Diana believed that only love could truly rid the world of his influence. Diana was successfully able to complete the task she was sent out by defeating Ares and saving the world. 
")

writeLines(txt, tf <- tempfile())

library(stringi)
library(cleanNLP)
cnlp_init_tokenizers()
anno <- cnlp_annotate(tf)
names(anno)
get_token(anno)

cnlp_init_spacy()
anno <- cnlp_annotate(tf)
get_token(anno)

cnlp_init_corenlp()
4

0 回答 0