count_lexicon_vec: Count hits in a lexicon

View source: R/NAME_count_lexicon_vec.R

count_lexicon_vecR Documentation

Count hits in a lexicon

Description

Counts the number of times a string is detected in a lexicon, according to a (regex) pattern. This function is based on a inner join of the text and the dictionary.

Usage

count_lexicon_vec(vec, lexicon_vec)

Arguments

vec

String (vector) in which the occurences of words from lexicon should be counted

lexicon_vec

vector of target words which should be counted in text

Value

Number of hits of text in dictionary

Examples

my_txt <- c("Hello you! Too bad you are not here")
my_dict <- c("Bad", "good")
count_lexicon_vec(my_txt, my_dict)
1

sebastiansauer/prada documentation built on Jan. 17, 2024, 11:05 a.m.