aboutsummaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'check.py')
-rwxr-xr-xcheck.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/check.py b/check.py
new file mode 100755
index 0000000..44a7f70
--- /dev/null
+++ b/check.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import fileinput
+from math import log
+
+if __name__ == '__main__':
+ scores = dict()
+ for line in fileinput.input():
+ query, dbpediaid, relevance, field, nvalues, nmatches = line.split('\t')
+ if field not in scores:
+ scores[field] = 0
+ scores[field] += float(relevance) * log(1 + int(nmatches)/int(nvalues))
+
+ for field, score in scores.items():
+ print('{}\t{}'.format(field, score))