drop_terms: Drop Terms from a Term List

Description Usage Arguments Value Examples

View source: R/drop_terms.R

Description

drop_terms Usage allows the user to explore/iterate on a term list and drop terms prior prior to term_count use without manually editing an external term list file.

drop_terms_regex Contol fixed parameter with function name, in this case, drop.terms is matched via regex.

drop_terms_fixed Contol fixed parameter with function name, in this case, drop.terms is matched via exactly.

keep_terms_regex Negated version of drop_terms_regex.

keep_terms_fixed Negated version of drop_terms_fixed.

keep_terms Negated version of drop_terms.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
drop_terms(x, drop.terms, fixed = TRUE, negate = FALSE, ...)

drop_terms_regex(x, drop.terms, negate = FALSE, ...)

drop_terms_fixed(x, drop.terms, negate = FALSE, ...)

keep_terms_regex(x, drop.terms, negate = TRUE, ...)

keep_terms_fixed(x, drop.terms, negate = TRUE, ...)

keep_terms(x, drop.terms, fixed = TRUE, negate = TRUE, ...)

Arguments

x

A term list.

drop.terms

A vector of terms to drop or a regex.

fixed

logical. If FALSE then drop.terms may be a regex.

negate

logical. If TRUE then the drop.terms will be kept.

...

If fixed = FALSE then other terms passed to search_term_which, otherwise, ignored.

Value

Returns a term list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Single level term list
discoure_markers <- list(
    response_cries = c("\\boh", "\\bah", "\\baha", "\\bouch", "yuk"),
    back_channels = c("uh[- ]huh", "uhuh", "yeah"),
    summons = "hey",
    justification = "because"
)
drop_terms(discoure_markers, 'response_cries')
drop_terms(discoure_markers, c('summons', 'response_cries'))
drop_terms_regex(discoure_markers, 'on')

## Hierarchical term list
trpl_list <- list(
    list(
        response_cries = c("\\boh", "\\bah", "\\baha", "\\bouch", "yuk"),
        back_channels = c("uh[- ]huh", "uhuh", "yeah"),
        summons = "hey",
        justification = "because"
    ),
    list(summons ='the'),
    list(summons = 'it', justification = 'ed\\s')
)

drop_terms(trpl_list, 'response_cries')
drop_terms(trpl_list, c('summons', 'response_cries'))
drop_terms(trpl_list, c('summons', 'response_cries', 'justification'))
drop_terms_regex(trpl_list, '[ln]s')
keep_terms_regex(trpl_list, '[ln]s')

trinker/termco documentation built on Jan. 7, 2022, 3:32 a.m.