I have key-value pairs of text. The values can be multiple words (n-grams). For example,
A abcd A efgh B abcd C wxyz C mnop
I want to calculate Pointwise Mutual Information for the pairs. Is there a function in R to do this? Otherwise, how can I go about it?