vumix/commit

use relative TF

authorMichiel Hildebrand
Fri May 18 18:14:14 2012 +0200
committerMichiel Hildebrand
Fri May 18 18:14:14 2012 +0200
commite07369e562569ecf237237082de7b0c17ab13cae
tree6519851d9887c252095a7949b64556651b58f7bc
parente228ed41f4ff18131555560d96b1dd82f9730ad4
Diff style: patch stat
diff --git a/lib/tfidf.pl b/lib/tfidf.pl
index 27fb2d5..f323d44 100644
--- a/lib/tfidf.pl
+++ b/lib/tfidf.pl
@@ -47,10 +47,13 @@ document_term(D, T) :-
 	%S > 5.
 
 tf(T, D, TF) :-
+	findall(A, rdf(D, pprime:hasAnnotation, A), As),
 	findall(T,
 		document_term(D, T),
 		Ts),
-	length(Ts, TF).
+	length(As, Total),
+	length(Ts, Occ),
+	TF is Occ/Total.
 
 idf(T, Collection, IDF) :-
 	length(Collection, CollectionSize),