From: Wolfgang M. M. <wol...@us...> - 2004-07-14 19:03:38
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14412/src/org/exist/xquery/functions/text Modified Files: TextRank.java Log Message: Added optional term frequency counts to fulltext index. Index: TextRank.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/text/TextRank.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TextRank.java 30 Mar 2004 17:12:52 -0000 1.1 --- TextRank.java 14 Jul 2004 19:03:25 -0000 1.2 *************** *** 23,29 **** package org.exist.xquery.functions.text; - import java.util.Set; - import java.util.TreeSet; - import org.exist.dom.Match; import org.exist.dom.NodeProxy; --- 23,26 ---- *************** *** 69,80 **** return DoubleValue.ZERO; NodeProxy proxy = (NodeProxy)val; // this is a persistent node, so casting is safe ! Set distinctTerms = new TreeSet(); Match nextMatch = proxy.match; // we just count the number of distinct terms matched while(nextMatch != null) { ! distinctTerms.add(nextMatch.getMatchingTerm()); nextMatch = nextMatch.getNextMatch(); } ! return new DoubleValue(distinctTerms.size()); } } --- 66,78 ---- return DoubleValue.ZERO; NodeProxy proxy = (NodeProxy)val; // this is a persistent node, so casting is safe ! ! int freq = 0; Match nextMatch = proxy.match; // we just count the number of distinct terms matched while(nextMatch != null) { ! freq += nextMatch.getFrequency(); nextMatch = nextMatch.getNextMatch(); } ! return new DoubleValue(freq); } } |