Browse CVS Repository
Diff of /gikonavigoeson/gikonavi/GikoBayesian.pas
Parent Directory
| Revision Log
| Revision Graph
| Patch
| 629 |
end; |
end; |
| 630 |
mean := mean / wordCount.Count; |
mean := mean / wordCount.Count; |
| 631 |
|
|
| 632 |
cnt := 0; |
P1 := 1; |
| 633 |
P1 := 0; |
Q1 := 1; |
|
Q1 := 0; |
|
| 634 |
for i := 0 to wordCount.Count - 1 do begin |
for i := 0 to wordCount.Count - 1 do begin |
| 635 |
countInfo := TWordCountInfo( wordCount.Objects[ i ] ); |
countInfo := TWordCountInfo( wordCount.Objects[ i ] ); |
| 636 |
n := f( countInfo.WordCount, narray[ i ], mean ); |
n := f( countInfo.WordCount, narray[ i ], mean ); |
| 637 |
if countInfo <> nil then |
P1 := P1 * ( 1 - n ); |
| 638 |
cnt := cnt + countInfo.WordCount; |
Q1 := Q1 * n; |
|
P1 := P1 + Ln( 1 - n ) * countInfo.WordCount; |
|
|
Q1 := Q1 + Ln( n ) * countInfo.WordCount; |
|
| 639 |
end; |
end; |
| 640 |
|
cnt := wordCount.Count; |
| 641 |
if cnt = 0 then |
if cnt = 0 then |
| 642 |
cnt := 1; |
cnt := 1 |
| 643 |
P1 := 1 - Exp( P1 * (1 / cnt) ); |
else |
| 644 |
Q1 := 1 - Exp( Q1 * (1 / cnt) ); |
P1 := 1 - Power( P1, 1 / cnt ); |
| 645 |
|
Q1 := 1 - Power( Q1, 1 / cnt ); |
| 646 |
|
|
| 647 |
if P1 + Q1 = 0 then begin |
if P1 + Q1 = 0 then begin |
| 648 |
Result := 0.5 |
Result := 0.5 |
|
|
Legend:
| Removed from v.1.9 |
|
| changed lines |
| |
Added in v.1.10 |
|
|
|