首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >R- NLP -提取对

R- NLP -提取对
EN

Stack Overflow用户
提问于 2021-11-18 23:05:35
回答 1查看 32关注 0票数 0
  • 嗨,伙计们,我刚开始使用R.的NLP算法,我想从pdf中提取一对(动词-名词)吗?我被一个频率的单词主题卡住了。比如“在刑事诉讼、民事诉讼和其他法律诉讼中代表客户,起草法律文件,或管理或为客户提供法律交易方面的建议。可能专攻某一领域,也可能在许多法律领域广泛应用。”
  • I希望从中提取动词-名词。我会怎么做?
EN

回答 1

Stack Overflow用户

发布于 2021-11-19 08:56:49

代码语言:javascript
运行
复制
> library(udpipe)
> docs <- "Represent clients in criminal and civil litigation and other legal proceedings, draw up legal documents, or manage or advise clients on legal transactions. May specialize in a single area or may practice broadly in many areas of law."
> docs <- setNames(docs, "doc1")
> anno <- udpipe(docs, object = "english", udpipe_model_repo = "bnosac/udpipe.models.ud")
> anno <- cbind_dependencies(anno, type = "parent")
> subset(anno, upos_parent %in% c("NOUN", "VERB") & upos %in% c("NOUN", "VERB"), 
+        select = c("doc_id", "paragraph_id", "sentence_id", "token", "token_parent", "dep_rel", "upos", "upos_parent"))
   doc_id paragraph_id sentence_id        token token_parent dep_rel upos upos_parent
2    doc1            1           1      clients    Represent     obj NOUN        VERB
7    doc1            1           1   litigation    Represent     obl NOUN        VERB
11   doc1            1           1  proceedings   litigation    conj NOUN        NOUN
13   doc1            1           1         draw    Represent    conj VERB        VERB
16   doc1            1           1    documents         draw     obj NOUN        VERB
19   doc1            1           1       manage    documents    conj NOUN        NOUN
21   doc1            1           1       advise      clients    conj NOUN        NOUN
22   doc1            1           1      clients    Represent     obj NOUN        VERB
25   doc1            1           1 transactions      clients    nmod NOUN        NOUN
32   doc1            1           2         area   specialize     obl NOUN        VERB
35   doc1            1           2     practice   specialize    conj VERB        VERB
39   doc1            1           2        areas     practice     obl NOUN        VERB
41   doc1            1           2          law        areas    nmod NOUN        NOUN
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70027860

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档