Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/GikoBayesian.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10 by yoffy, Sun Oct 31 12:24:33 2004 UTC revision 1.11 by yoffy, Sun Oct 31 16:48:44 2004 UTC
# Line 369  var Line 369  var
369          idx : Integer;          idx : Integer;
370  begin  begin
371    
372          idx := IndexOf( name ); // 激遅          if Find( name, idx ) then
373          if idx < 0 then                  Result := TWordInfo( inherited Objects[ idx ] )
                 Result := nil  
374          else          else
375                  Result := TWordInfo( inherited Objects[ idx ] );                  Result := nil;
376    
377  end;  end;
378    
# Line 385  var Line 384  var
384          idx : Integer;          idx : Integer;
385  begin  begin
386    
387          idx := IndexOf( name );          if Find( name, idx ) then
388          if idx < 0 then                  inherited Objects[ idx ] := value
                 AddObject( name, value )  
389          else          else
390                  inherited Objects[ idx ] := value;                  AddObject( name, value );
391    
392  end;  end;
393    
# Line 415  var Line 413  var
413          i, idx                          : Integer;          i, idx                          : Integer;
414          countInfo                       : TWordCountInfo;          countInfo                       : TWordCountInfo;
415  const  const
416          KAKUJOSI = 'を' + #10 + 'に' + #10 + 'が' + #10 + 'と' + #10 + 'から' +          KAKUJOSI = 'を' + #10 + 'に' + #10 + 'が' + #10 + 'と' + #10 + 'から'
417                  #10 + 'で' + #10 + 'へ' + #10 + 'より' + #10 + 'まで';                  + #10 + 'で' + #10 + 'へ' + #10 + 'より' + #10 + 'まで'
418                    ;{
419                    + #10 + 'これ' + #10 + 'それ' + #10 + 'あれ' + #10 + 'どれ'
420                    + #10 + 'この' + #10 + 'その' + #10 + 'あの' + #10 + 'どの'
421                    + #10 + 'こう' + #10 + 'そう' + #10 + 'ああ' + #10 + 'どう'
422                    + #10 + 'こんな' + #10 + 'そんな' + #10 + 'あんな' + #10 + 'どんな'
423                    + #10 + '的' + #10 + '性' + #10 + '式' + #10 + '化' + #10 + '法'
424                    + #10 + '不' + #10 + '無' + #10 + '非'
425                    + #10 + 'また'
426                    + #10 + 'しかし' + #10 + 'だが' + #10 + 'けど' + #10 + 'けれど'
427                    + #10 + 'やはり' + #10 + 'やっぱり'
428                    + #10 + 'です' + #10 + 'ます' + #10 + 'でし' + #10 + 'だろ'
429                    + #10 + 'する' + #10 + 'しない' + #10 + 'した' + #10 + 'しない'
430                    ;}
431          kKanji = [$80..$A0, $E0..$ff];          kKanji = [$80..$A0, $E0..$ff];
432  begin  begin
433    
# Line 475  begin Line 486  begin
486                          if (mode <> newMode) or delimited then begin                          if (mode <> newMode) or delimited then begin
487    
488                                  // 文字のタイプが変更された                                  // 文字のタイプが変更された
                                 // もしくは区切りになる文字に遭遇した  
489                                  if mode <> ModeWhite then begin                                  if mode <> ModeWhite then begin
490                                          SetLength( aWord, p - last );                                          SetLength( aWord, p - last );
491                                          CopyMemory( PChar( aWord ), last, p - last );                                          CopyMemory( PChar( aWord ), last, p - last );
492                                          //aWord := Copy( last, 0, p - last );                                          //aWord := Copy( last, 0, p - last );
493                                          idx := wordCount.IndexOf( aWord );      // 遅                                          if wordCount.Find( aWord, idx ) then begin
494                                          if idx < 0 then begin                                                  countInfo := TWordCountInfo( wordCount.Objects[ idx ] );
495                                            end else begin
496                                                  countInfo := TWordCountInfo.Create;                                                  countInfo := TWordCountInfo.Create;
497                                                  wordCount.AddObject( aWord, countInfo );                                                  wordCount.AddObject( aWord, countInfo );
                                         end else begin  
                                                 countInfo := TWordCountInfo( wordCount.Objects[ idx ] );  
498                                          end;                                          end;
499                                          countInfo.WordCount := countInfo.WordCount + 1;                                          countInfo.WordCount := countInfo.WordCount + 1;
500                                  end;                                  end;
501    
502                                  last := p;                                  last := p;
503    
504                                    // 区切りになる文字に遭遇した
505                                    if delimited then begin
506                                            SetLength( aWord, chSize );
507                                            CopyMemory( PChar( aWord ), last, chSize );
508                                            //aWord := Copy( last, 0, p - last );
509                                            if wordCount.Find( aWord, idx ) then begin
510                                                    countInfo := TWordCountInfo( wordCount.Objects[ idx ] );
511                                            end else begin
512                                                    countInfo := TWordCountInfo.Create;
513                                                    wordCount.AddObject( aWord, countInfo );
514                                            end;
515                                            countInfo.WordCount := countInfo.WordCount + 1;
516                                            last := last + chSize;
517                                    end;
518    
519                                  mode := newMode;                                  mode := newMode;
520    
521                          end;                          end;
# Line 500  begin Line 525  begin
525    
526                  if mode <> ModeWhite then begin                  if mode <> ModeWhite then begin
527                          aWord := Copy( last, 0, p - last );                          aWord := Copy( last, 0, p - last );
528                          idx := wordCount.IndexOf( aWord );                          if wordCount.Find( aWord, idx ) then begin
529                          if idx < 0 then begin                                  countInfo := TWordCountInfo( wordCount.Objects[ idx ] );
530                            end else begin
531                                  countInfo := TWordCountInfo.Create;                                  countInfo := TWordCountInfo.Create;
532                                  wordCount.AddObject( aWord, countInfo );                                  wordCount.AddObject( aWord, countInfo );
                         end else begin  
                                 countInfo := TWordCountInfo( wordCount.Objects[ idx ] );  
533                          end;                          end;
534                          countInfo.WordCount := countInfo.WordCount + 1;                          countInfo.WordCount := countInfo.WordCount + 1;
535                  end;                  end;

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26