Package: rsyntax 0.1.4

rsyntax: Extract Semantic Relations from Text by Querying and Reshaping Syntax

Various functions for querying and reshaping dependency trees, as for instance created with the 'spacyr' or 'udpipe' packages. This enables the automatic extraction of useful semantic relations from texts, such as quotes (who said what) and clauses (who did what). Method proposed in Van Atteveldt et al. (2017) <doi:10.1017/pan.2016.12>.

Authors:Kasper Welbers and Wouter van Atteveldt

rsyntax_0.1.4.tar.gz
rsyntax_0.1.4.zip(r-4.5)rsyntax_0.1.4.zip(r-4.4)rsyntax_0.1.4.zip(r-4.3)
rsyntax_0.1.4.tgz(r-4.4-any)rsyntax_0.1.4.tgz(r-4.3-any)
rsyntax_0.1.4.tar.gz(r-4.5-noble)rsyntax_0.1.4.tar.gz(r-4.4-noble)
rsyntax_0.1.4.tgz(r-4.4-emscripten)rsyntax_0.1.4.tgz(r-4.3-emscripten)
rsyntax.pdf |rsyntax.html
rsyntax/json (API)

# Install 'rsyntax' in R:
install.packages('rsyntax', repos = c('https://kasperwelbers.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Datasets:

On CRAN:

This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.

3.20 score 4 packages 18 scripts 1.5k downloads 40 exports 20 dependencies

Last updated 2 years agofrom:4264352d40. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKOct 26 2024
R-4.5-winOKOct 26 2024
R-4.5-linuxOKOct 26 2024
R-4.4-winOKOct 26 2024
R-4.4-macOKOct 26 2024
R-4.3-winOKOct 26 2024
R-4.3-macOKOct 26 2024

Exports:%>%add_span_quotesANDannotateannotate_nodesannotate_tqueriesapply_queriesas_tokenindexBREAKcast_textchildrenchopclimb_treecopy_fillcopy_nodescustom_fillfillget_branch_idget_long_idsget_nodesisolate_branchmutate_nodesNOTnot_childrennot_parentsORparentsplot_treeremove_fillremove_nodesreselect_nodesrsyntax_threadsselect_nodesselected_nodesset_rsyntax_threadssplit_UD_conjsubset_nodessyntax_readertqueryunselect_nodes

Dependencies:base64encclicpp11data.tabledigestglueigraphlatticelifecyclemagrittrMatrixpkgconfigpngRcpprlangstringitidyselecttokenbrowservctrswithr

Readme and manuals

Help Manual

Help pageTopics
Add span quotes to a source-quote annotationsadd_span_quotes
Use AND search in tqueryAND
Annotate a tokenlist based on rsyntax queriesannotate
Annotate a tokenlist based on rsyntaxNodesannotate_nodes
Annotate a tokenlist based on rsyntax queriesannotate_tqueries
Apply queries created with tqueryapply_queries
Prepare a tokenIndexas_tokenindex
A special NOT condition if depth > 1BREAK
Cast annotations to textcast_text
Chop of a branch of the treechop
Have a node adopt its parent's positionclimb_tree
Copy nodescopy_fill
Copy nodescopy_nodes
Specify custom fill behaviorcustom_fill
Dutch lemmadutch
Specify custom fill behaviorfill
Add the branch id as a column to the tokenindexget_branch_id
Get ids in various forms to extract token_idsget_long_ids
Transform the nodes to long format and match with token dataget_nodes
Isolate a branch in a dependency treeisolate_branch
Mutate nodesmutate_nodes
Search for parents or children in tquerychildren nested_nodes not_children not_parents parents
Use NOT search in tqueryNOT
Use OR search in tqueryOR
Create an igraph tree from a sentenceplot_tree
S3 print for tQuery classprint.tQuery
Quote punctuationquote_punctuation
Remove fillremove_fill
Remove nodesremove_nodes
Within a chain of reshape operations, reapply the tqueryreselect_nodes
Get the number of threads to be used by rsyntax functionsrsyntax_threads
Apply tquery to initiate reshape operationsselect_nodes
If select_nodes() is used, the selected nodes can be extracted with selected_nodes(). This is mainly for internal use, but it can also be usefull for debugging, and to controll loops of reshape operation (e.g. break if no selected nodes left)selected_nodes
Set number of threads to be used by rsyntax functionsset_rsyntax_threads
Split conjunctions for dependency trees in Universal Dependenciessplit_UD_conj
Subset a select_nodes selectionsubset_nodes
Create a full text browser with highlighted rsyntax annotationssyntax_reader
Example tokens for coreNLP Englishtokens_corenlp
Example tokens for Dutch clausestokens_dutchclauses
Example tokens for Dutch quotestokens_dutchquotes
Example tokens for spacy Englishtokens_spacy
Create a query for dependency based parse trees in a data.table (CoNLL-U or similar format).tquery
Undo select_nodesunselect_nodes