Created
November 23, 2022 08:46
-
-
Save vanatteveldt/bf9a4572bc18b19e97dc156ebffc96b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install.packages("udpipe") | |
install.packages("rsyntax") | |
library(udpipe) | |
tokens = udpipe('John Doe, who is a great guy, said yesterday that all was well', 'english') |> | |
as_tokenindex() | |
plot_tree(tokens, token, lemma, upos) | |
verbs = c("tell", "show", "acknowledge", "admit", "affirm", "allege", | |
"announce", "assert", "attest", "avow", "call", "claim", "comment", | |
"concede", "confirm", "declare", "deny", "exclaim", "insist", "mention", | |
"note", "post","predict", "proclaim", "promise", "reply", "remark", | |
"report", "say", "speak", "state", "suggest", "talk", "tell", "think", | |
"warn","write", "add") | |
direct = tquery(lemma = verbs, label='verb', | |
children(req=FALSE, relation = c('npadvmod'), block=TRUE), | |
children(relation=c('su','nsubj','agent','nmod:agent'), label='source'), | |
children(label='quote')) | |
tokens = annotate_tqueries(tokens, 'quote', dir=direct) | |
syntax_reader(tokens, annotation = 'quote', value = 'source') | |
plot_tree(tokens, token, lemma, upos, annotation='quote', ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment