aboutsummaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'check.py')
-rwxr-xr-xcheck.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/check.py b/check.py
new file mode 100755
index 0000000..69c247c
--- /dev/null
+++ b/check.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+
+import fileinput
+
+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) * int(nmatches) / int(nvalues)
+
+ for field, score in scores.items():
+ print('{}\t{}'.format(field, score))