conditionalProbability: Conditional Probabilities for Word by TermFrequency

Description Usage Arguments Value Examples

View source: R/classifier.R

Description

this function takes a token and calculates the conditional probability of the token appearing in each classLabel. This can then be used to get the likelihood ratio of the token belonging to each classLabel.

Usage

1
conditionalProbability(token, termFrequency)

Arguments

token

a single token

termFrequency

an object of class TermFrequency

Value

a conditional probability for the token belonging to each class given it's term frequency

Examples

1
2
3
corpusEx <- Corpus(list('first' = c('a single entry document'), 'second' = c('a two entry document','with two separate entries')))
termFreqEx <- TermFrequency(corpusEx)
P_token <- conditionalProbability( 'entr', termFreqEx)

duncankmckinnon/ezRnlp documentation built on Aug. 6, 2020, 1:28 a.m.