View source: R/calc_assoc_metrics.R
calculate_bigram_probabilities | R Documentation |
Helper function that calculates joint and marginal probabilities for bigrams in the input data using dplyr. It processes the data to create bigrams and computes their probabilities along with individual token probabilities.
calculate_bigram_probabilities(data, doc_index, token_index, type)
data |
A data frame containing the corpus |
doc_index |
Column name for document index |
token_index |
Column name for token position |
type |
Column name for the actual tokens/terms |
A data frame containing:
x: First token in bigram
y: Second token in bigram
p_xy: Joint probability of the bigram
p_x: Marginal probability of first token
p_y: Marginal probability of second token
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.