我不知道这是否是正确的地方,但如果可能的话,你能帮我用 R 将文本分成几个句子吗?我有一个数据库,其中包含对员工执行的活动的描述。我想把这段文字分成几个句子,然后从每个句子中提取动词-名词对。我可以逐行执行此操作,但是由于行数很多,因此需要很长时间,所以我想知道你们是否知道如何为整个专栏执行此操作。你们可以在以下位置查看数据库:https ://docs.google.com/spreadsheets/d/1NiMj37q8_hJhuNFCiQcjO6UBvI9_-OM4/edit?usp=sharing&ouid=115543599430411372875&rtpof=true&sd=true
我可以像下面的代码一样一一做,但我想为整个描述做
library(udpipe)
> docs <- "Determine and formulate policies and provide overall direction of companies or private and public sector organizations within guidelines set up by a board of directors or similar governing body. Plan, direct, or coordinate operational activities at the highest level of management with the help of subordinate executives and staff managers."
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"))