Learn R Programming

MadanText (version 0.1.0)

PMI: Calculate Pointwise Mutual Information (PMI)

Description

This function calculates the PMI for collocations in a given text data.

Usage

PMI(x)

Value

Returns a data frame where each row represents a unique keyword (collocation) in the input data. The data frame contains columns such as 'keyword', representing the keyword, and 'pmi', representing the PMI score of that keyword. Higher PMI scores indicate a stronger association between the components of the collocation within the corpus.

Arguments

x

A data frame with columns 'token' and 'doc_id'.

Examples

Run this code
data <- data.frame(token = c("word1", "word2"), doc_id = c(1, 1))
pmi_scores <- PMI(data)

Run the code above in your browser using DataLab