R

时间:2018-06-14 08:52:54

标签: r bayesian text-analysis bnlearn

我有一个页面的故事(即文本数据),我需要在该故事上使用贝叶斯网络并进行分析。有人能告诉我是否有可能 R ?如果是,那该怎么办?

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

  

Krishna的Dharam-shasthra到Arjuna:

     

Gita是Krishna和Arjuna之间的对话,导致了战斗。   克里希纳强调了两个术语:业力和佛法。他告诉阿尔琼,这是一场正义的战争;一场佛法战争。佛法是正义的方式或一套规则和法律。 Kauravas站在Adharma的一边,违反了规则和法律,因此Arjun必须做他的业力以维护佛法。   阿朱那不想打架。他不明白为什么他必须为一个他甚至不一定想要的王国流下他的家人的血。在他的眼里,杀死他的邪恶并杀死他的家人是所有人中最大的罪。他放下武器告诉奎师那他不会打架。然后,克里希纳开始系统化地解释为什么Arjuna的战斗责任以及为了恢复他的业力他必须如何战斗。

     

克里希纳首先解释了出生和死亡的轮回周期。他说灵魂并没有真正的死亡只是在每一轮出生和死亡结束时身体脱落。这个循环的目的是让一个人解决他们的业力,这些业力是通过行动的一生来积累的。如果一个人无私地完成行动,为上帝服务,那么他们就可以解决他们的业力,最终导致灵魂的解体,启蒙和vijnana的成就,以及结束轮回周期。如果他们自私地行动,那么他们就会不断积累债务,将他们进一步陷入业力债务。

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

预处理应遵循的步骤是:

  1. 句法处理(后标记)
  2. SRL算法(故事中人物的语义角色标记)
  3. 会议决议
  4. 使用以上所有内容,我需要创建一个知识库并创建一个贝叶斯网络。

    这是我到目前为止尝试使用post tagger的方法:

    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()
    

0 个答案:

没有答案