OSDN Git Service

漢字の取り扱いがおかしいので戻した。
authoryoffy <yoffy>
Thu, 21 Oct 2004 03:46:57 +0000 (03:46 +0000)
committeryoffy <yoffy>
Thu, 21 Oct 2004 03:46:57 +0000 (03:46 +0000)
GikoBayesian.pas

index 4535edc..a9e4c54 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.4 2004/10/21 03:18:44 yoffy Exp $
+$Id: GikoBayesian.pas,v 1.5 2004/10/21 03:46:57 yoffy Exp $
 }
 
 interface
@@ -413,6 +413,7 @@ var
 const
        KAKUJOSI = '\82ð' + #10 + '\82É' + #10 + '\82ª' + #10 + '\82Æ' + #10 + '\82©\82ç' +
                #10 + '\82Å' + #10 + '\82Ö' + #10 + '\82æ\82è' + #10 + '\82Ü\82Å';
+       kKanji = [$80..$A0, $E0..$ff];
 begin
 
        delimiter := TStringList.Create;
@@ -427,7 +428,8 @@ begin
                        delimited := False;
                        // \95\8e\9a\82Ì\83^\83C\83v\82ð\94»\95Ê
                        // \81¦\8bå\93Ç\93_\82Í ModeGraph \82É\82È\82é\82Ì\82Å\8cÂ\95Ê\82É\91Î\89\9e\82µ\82È\82­\82Ä\82à\82¢\82¢
-                       if Byte(Byte( p^ ) - $a1) < $5e then begin
+//                     if Byte(Byte( p^ ) - $a1) < $5e then begin
+                       if Byte( p^ ) in kKanji then begin
                                if p + 1 < tail then begin
                                        ch := (PByte( p )^ shl 8) or PByte( p + 1 )^;
                                        case ch of
@@ -457,7 +459,6 @@ begin
                                        end;
                                end;
                        end else begin
-                               // \81ª\81«\95Ï\82í\82ç\82¸
                                newMode := Modes( CharMode1[ Byte( p^ ) ] );
 
                                chSize := 1;
@@ -470,6 +471,7 @@ begin
                                if mode <> ModeWhite then begin
                                        SetLength( aWord, p - last );
                                        CopyMemory( PChar( aWord ), last, p - last );
+                                       //aWord := Copy( last, 0, p - last );
                                        idx := wordCount.IndexOf( aWord );      // \92x
                                        if idx < 0 then begin
                                                countInfo := TWordCountInfo.Create;