OSDN Git Service

辞書が壊れていてもいいように、値がマイナス値を取れないよう修正。
authoryoffy <yoffy>
Thu, 21 Oct 2004 05:59:39 +0000 (05:59 +0000)
committeryoffy <yoffy>
Thu, 21 Oct 2004 05:59:39 +0000 (05:59 +0000)
GikoBayesian.pas

index dfbcad3..96646b1 100644 (file)
@@ -4,7 +4,7 @@ unit GikoBayesian;
 \file          GikoBayesian.pas
 \brief \83x\83C\83W\83A\83\93\83t\83B\83\8b\83^
 
-$Id: GikoBayesian.pas,v 1.7 2004/10/21 04:28:15 yoffy Exp $
+$Id: GikoBayesian.pas,v 1.8 2004/10/21 05:59:39 yoffy Exp $
 }
 
 interface
@@ -717,11 +717,15 @@ begin
 
                countinfo := TWordCountInfo( wordCount.Objects[ i ] );
                if isImportant then begin
-                       wordinfo.ImportantWord := wordinfo.ImportantWord - countinfo.WordCount;
-                       wordinfo.ImportantText := wordinfo.ImportantText - 1;
+                       if wordInfo.ImportantText > 0 then begin
+                               wordinfo.ImportantText := wordinfo.ImportantText - 1;
+                               wordinfo.ImportantWord := wordinfo.ImportantWord - countinfo.WordCount;
+                       end;
                end else begin
-                       wordinfo.NormalWord := wordinfo.NormalWord - countinfo.WordCount;
-                       wordinfo.NormalText := wordinfo.NormalText - 1;
+                       if wordinfo.NormalText > 0 then begin
+                               wordinfo.NormalText := wordinfo.NormalText - 1;
+                               wordinfo.NormalWord := wordinfo.NormalWord - countinfo.WordCount;
+                       end;
                end;
        end;