• R/O
  • SSH
  • HTTPS

nls: 提交


Commit MetaInfo

修订版16 (tree)
时间2011-05-16 15:56:24
作者linuxchecker

Log Message

added calc module

更改概述

差异

--- src/org/mathsci/distance/NldCalc.java (nonexistent)
+++ src/org/mathsci/distance/NldCalc.java (revision 16)
@@ -0,0 +1,43 @@
1+package org.mathsci.distance;
2+
3+import java.util.Date;
4+
5+class NldCalc extends NldCore
6+{
7+ public NldCalc()
8+ {
9+ super();
10+ }
11+ public double computeScore(String[] args)
12+ {
13+ double x,y,xy,lx,ly,lxy;
14+ double m = max_pages;
15+ double val = 0d;
16+ Date start_time = new Date();
17+ try{
18+
19+ if(timewatch) System.out.println("time="+(new Date().getTime()-start_time.getTime()));
20+ NldSearcher s = new NldSearcher();
21+ if(timewatch) System.out.println("time="+(new Date().getTime()-start_time.getTime()));
22+ x = s.searcher(args[1]);
23+ if(timewatch) System.out.println("time="+(new Date().getTime()-start_time.getTime()));
24+ y = s.searcher(args[2]);
25+ if(timewatch) System.out.println("time="+(new Date().getTime()-start_time.getTime()));
26+ xy = s.searcher(args[1]+" AND "+args[2]);
27+ if(timewatch) System.out.println("time="+(new Date().getTime()-start_time.getTime()));
28+ lx = Math.log(x);
29+ ly = Math.log(y);
30+ lxy = Math.log(xy);
31+
32+ if(debug_level>1)
33+ {
34+ System.out.println((new String(args[1].getBytes(),"UTF-8"))+" <> "+args[2]);
35+ }
36+ val = (Math.max(lx,ly)-lxy)/(Math.log(m)-Math.min(lx,ly));
37+ s.close();
38+ }catch(Exception e){
39+ e.printStackTrace();
40+ }
41+ return(val);
42+ }
43+}
Show on old repository browser