# Naive Bayes non-Dictionary Term in Test Document

Using Laplacian Smoothing we can get rid of 0 probabilities if a term occur in spam and does not occur in ham class or vice versa. My question is about what if a term in test document does not occur in training dataset(i.e. in dictionary). For example if we extend example in page 44 in -> http://www.stanford.edu/class/cs124/lec/naivebayes.pdf as follows:

(Consider only change is test document part)

Test 5 Chinese Chinese Chinese Tokyo Japan Greek ?

P(c|d5)'s calculation requires P(Greek|c). However since Greek doesn't exist in dictionary we didn't calculate it before. What should P(Greek|c)'s and P(Greek|j)'s value?

One common solution is to treat tokens seen less than $n$ times (across all classes) as a special "unknown" or "rare" token. You then use this probability to assign values to legitimately unknown known words.