Quantcast
Viewing all articles
Browse latest Browse all 205343

how to obtain morphological features of head_token along with lemma in Udpipe?

I am relatively new to Udpipe-environment. Is there a way to extract morphological features of headtokens and along with KWIC in same dataframe in Udpipe? For instance, I would like to get subjects and objects of certain verbs based on dep_rel. However, I would like to extract feats for verbs as well. In this case, regarding dep_rel of both nsubj and obj %in% upos Noun, Verbs are tagged with headtoken_id. is it possible to get morphological feats of Verbs in the same df? Unfortunately, cbind_depend function only allows "parent" not "child" yet. How about a workaround?

Best.

What I did so far is as follows; x is data.frame

xsub <- subset(x, dep_rel %in% c("nsubj", "obj", "iobj") & upos %in% c("NOUN") & upos_parent %in% c("VERB"))
xhead <- xsub[, c("token_id", "token", "head_token_id", "dep_rel")]
headtokens = xhead$head_token_id
xsubverbs <- subset(x, head_token_id %in% headtokens)
xsubverbs <- subset(x, upos %in% c("VERB") & head_token_id %in% headtokens)

I am able to extract all the verbs related to dep_rel of c("nsubj", "obj", "iobj") & upos %in% c("NOUN") .

Now I need to merge two data into a single one stating feats of both groups.

Update: I found out the solution using merge and re-doing all the filtering via codes given above. Now I have both feats info for KWIC and parent_lemma.


Viewing all articles
Browse latest Browse all 205343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>