bow_analysis: Compute how often a given set of words (descriptors) occur...

Description Usage Arguments Value

View source: R/bow_analysis.R

Description

Compute how often a given set of words (descriptors) occur within a given window around another set of words (phenomena) within a text. This can be computed as a ration of n occurrences descriptor/n total words in window or n occurrences descriptor / n occurrences phenomena.

Usage

1
2
3
4
5
6
7
8
bow_analysis(
  corpus,
  phenomenon,
  descriptors,
  window = 10,
  per_occurrence = TRUE,
  own_regex = FALSE
)

Arguments

corpus

the text or texts to be analyzed as a list of character vectors

phenomenon

a list of character vectors (or list of regular expressions if own_regex == TRUE) with terms around which descriptor terms are searched

descriptors

a list of characters vectors (or list of regular expressions if own_regex == TRUE) with descriptor terms to search

window

number of words left and right of a phenomenon term to be searched for a descriptor

per_occurrence

when TRUE divide the number of descriptor occurrences by the number of phenomena occurrences. when FALSE divide the number of descriptor occurrences by the total number of words within the windows around phenomena. Default TRUE.

own_regex

when TRUE allows you to add custom regular expressions for phenomenon and descriptors. when FALSE rbow will construct regular expression from the character vectors you supplied. defaults to FALSE

Value

list of analyzed texts. Each text list contains a list of results for each analyzed phenomenon. each phenomenon list contains a data frame summarizing the average number of descriptors occurrences for that phenomenon and a list of numeric vectors for each descriptor indicating the number of descriptor terms within a window for each phenomenon occurrence.


till-tietz/rbow documentation built on Oct. 21, 2021, 9:16 p.m.