| 213 |
|
|
| 214 |
property Bayesian : TGikoBayesian read FBayesian write FBayesian; |
property Bayesian : TGikoBayesian read FBayesian write FBayesian; |
| 215 |
function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string; |
function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string; |
| 216 |
|
//! 単語解析 |
| 217 |
|
procedure SpamCountWord( const text : string; wordCount : TWordCount ); |
| 218 |
|
//! 学習クリア |
| 219 |
|
procedure SpamForget( wordCount : TWordCount; isSpam : Boolean ); |
| 220 |
|
//! スパム学習 |
| 221 |
|
procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean ); |
| 222 |
|
//! スパム度数 |
| 223 |
|
function SpamParse( const text : string; wordCount : TWordCount ) : Extended; |
| 224 |
end; |
end; |
| 225 |
|
|
| 226 |
var |
var |
| 1008 |
|
|
| 1009 |
wordCount := TWordCount.Create; |
wordCount := TWordCount.Create; |
| 1010 |
try |
try |
| 1011 |
spamminess := Floor( FBayesian.Parse( |
spamminess := Floor( SpamParse( |
| 1012 |
Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 ); |
Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 ); |
| 1013 |
|
|
| 1014 |
Skin := CustomStringReplace( Skin, '<NUMBER/>', |
Skin := CustomStringReplace( Skin, '<NUMBER/>', |
| 3887 |
end; |
end; |
| 3888 |
|
|
| 3889 |
end; |
end; |
| 3890 |
|
|
| 3891 |
|
procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount ); |
| 3892 |
|
begin |
| 3893 |
|
|
| 3894 |
|
if Setting.SpamFilterAlgorithm = gsfaNone then Exit; |
| 3895 |
|
Bayesian.CountWord( text, wordCount ); |
| 3896 |
|
|
| 3897 |
|
end; |
| 3898 |
|
|
| 3899 |
|
procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean ); |
| 3900 |
|
begin |
| 3901 |
|
|
| 3902 |
|
if Setting.SpamFilterAlgorithm = gsfaNone then Exit; |
| 3903 |
|
Bayesian.Forget( wordCount, isSpam ); |
| 3904 |
|
|
| 3905 |
|
end; |
| 3906 |
|
|
| 3907 |
|
procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean ); |
| 3908 |
|
begin |
| 3909 |
|
|
| 3910 |
|
if Setting.SpamFilterAlgorithm = gsfaNone then Exit; |
| 3911 |
|
Bayesian.Learn( wordCount, isSpam ); |
| 3912 |
|
|
| 3913 |
|
end; |
| 3914 |
|
|
| 3915 |
|
function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended; |
| 3916 |
|
begin |
| 3917 |
|
|
| 3918 |
|
case Setting.SpamFilterAlgorithm of |
| 3919 |
|
gsfaNone: Result := 0; |
| 3920 |
|
gsfaPaulGraham: Result := Bayesian.Parse( text, wordCount, gbaPaulGraham ); |
| 3921 |
|
gsfaGaryRobinson: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinson ); |
| 3922 |
|
gsfaGaryRobinsonFisher: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinsonFisher ); |
| 3923 |
|
end; |
| 3924 |
|
|
| 3925 |
|
end; |
| 3926 |
|
|
| 3927 |
initialization |
initialization |
| 3928 |
GikoSys := TGikoSys.Create; |
GikoSys := TGikoSys.Create; |
| 3929 |
|
|