waka
waka

Reputation: 1

Split the string into multiple sentences with R and pos tagging

I don't know if this is the right place, but if possible, could you help me split a text into several sentences using R. I have a database that contains the description of activities that employees perform. I would like to split this text into several sentences and then extract the verb-noun pair from each sentence. I can do this line by line, but as there are many lines it would take forever, so I would like to know if you guys know how to do this for the entire column. You guys can see the database in: https://docs.google.com/spreadsheets/d/1NiMj37q8_hJhuNFCiQcjO6UBvI9_-OM4/edit?usp=sharing&ouid=115543599430411372875&rtpof=true&sd=true

I can do it one by one as the following code, but I would like to do it for the entire description

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

Upvotes: 0

Views: 202

Answers (0)

Related Questions