From 32cac42157e6e07202ed7d32ff7ddff43b4d6ba0 Mon Sep 17 00:00:00 2001
From: Victor Zimmermann <zimmermann@cl.uni-heidelberg.de>
Date: Wed, 7 Mar 2018 16:31:39 +0100
Subject: [PATCH] Add program to merge output files for single target words.

---
 code/result_merger.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 code/result_merger.py

diff --git a/code/result_merger.py b/code/result_merger.py
new file mode 100644
index 0000000..5c7c207
--- /dev/null
+++ b/code/result_merger.py
@@ -0,0 +1,23 @@
+import os
+
+file_path = '/home/students/zimmermann/Courses/ws17/fsem/absinth/clustering/'
+
+files = [file_path+'/'+f for f in os.listdir(file_path)]
+
+results = list()
+
+for f in files:
+    with open(f, 'r') as lines:
+        for line in lines.readlines()[1:]:
+            results.append(line.split('\t'))
+            
+sorted(results, key=lambda x: x[0])
+
+final = open('final.txt', 'w')
+
+final.write('subTopicID\tresultID\n')
+
+for r in results:
+    final.write('\t'.join(r))
+    
+final.close()
-- 
GitLab