# NOT RUN {
spacy_conjunctions <- function(tokens) {
no_fill = c('compound*','case', 'relcl')
tq = tquery(label='target', NOT(relation = 'conj'),
rsyntax::fill(NOT(relation = no_fill), max_window = c(Inf,0)),
children(relation = 'conj', label='origin',
rsyntax::fill(NOT(relation = no_fill), max_window=c(0,Inf))))
tokens = climb_tree(tokens, tq)
chop(tokens, relation = 'cc')
}
## spacy tokens for "Bob and John ate bread and drank wine"
tokens = tokens_spacy[tokens_spacy$doc_id == 'text5',]
tokens = spacy_conjunctions(tokens)
tokens
# }
# NOT RUN {
if (interactive()) plot_tree(tokens)
# }
Run the code above in your browser using DataLab