Export span annotations
Export columns from a tCorpus as span annotations (annotations over a span of text). The annotations are returned as a data.table where each row is an annotation, with columns: doc_id, variable, value, field, offset, length and text. The key purpose is that these span annotations are linked to exact character positions in the text. This also means that this function can only be used if position information is available (i.e. if remember_spaces=T was used when creating the tCorpus)
export_span_annotations(tc, variables)
tc |
A tCorpus, created with |
variables |
A character vector with variables (columns in tc$tokens) to export |
Note that if there are spans with gaps in them (e.g. based on proximity queries), they are split into different annotations. Thus some information can be lost.
A data.table where each row is a span annotation, with columns: doc_id, variable, value, field, offset, length, text
tc = create_tcorpus(sotu_texts, c('president','text'), doc_column='id', remember_spaces=TRUE) tc$code_features(c('war# war peace', 'us being# <(i we) (am are)>')) export_span_annotations(tc, 'code')
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.