Advertisement
Atheuz

Untitled

Nov 11th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1.         public decimal score(string x, Classification c)
  2.         {
  3.             decimal sum = 0;
  4.             foreach (string w in Tokenizer.tokenize(x))
  5.             {
  6.                 if (PxiC[c].ContainsKey(w))
  7.                 {
  8.                     decimal val = PxiC[c][w] / (1 - PxiC[c][w]);
  9.                     if (val != 0 || val > 0)
  10.                     {
  11.                         sum += (decimal)Math.Log((double)val);
  12.                     }
  13.                 }
  14.                
  15.             }
  16.  
  17.             return emptyScore[Classification.Positive] + sum;
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement