PhraseCount
By: a guest | May 1st, 2010 | Syntax:
VB.NET | Size: 0.99 KB | Hits: 108 | Expires: Never
Imports System
Imports System.Collections.Generic
Imports System.Text
Namespace BayesClassifier
Public Class ExcludedWords
Shared enu_most_common As String() = {"the", "to", "and", "a", "an", "in", _
"is", "it", "you", "that", "was", "for", _
"on", "are", "with", "as", "be", "been", _
"at", "one", "have", "this", "what", "which"}
Private m_Dict As Dictionary(Of String, Integer)
Public Sub New()
m_Dict = New Dictionary(Of String, Integer)()
End Sub
Public Sub InitDefault()
Init(enu_most_common)
End Sub
Public Sub Init(ByVal excluded As String())
m_Dict.Clear()
For i As Integer = 0 To excluded.Length - 1
m_Dict.Add(excluded(i), i)
Next
End Sub
Public Function IsExcluded(ByVal word As String) As Boolean
Return m_Dict.ContainsKey(word)
End Function
End Class
End Namespace