From b305b6882c2e74388dfd6675249651518f718702 Mon Sep 17 00:00:00 2001 From: Eliran Wong Date: Thu, 9 Aug 2018 13:42:15 +0100 Subject: [PATCH] Delete updateOpenGNTGloss.py --- Script/updateOpenGNTGloss.py | 54 ------------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 Script/updateOpenGNTGloss.py diff --git a/Script/updateOpenGNTGloss.py b/Script/updateOpenGNTGloss.py deleted file mode 100644 index 73e2ba8..0000000 --- a/Script/updateOpenGNTGloss.py +++ /dev/null @@ -1,54 +0,0 @@ -# This file is created for merging latest work on OpenGNTGloss and NET2Words into main database file OpenGNT.csv - -import re - -inputFile = 'OpenGNTGloss_working.csv' -outputFile = 'OpenGNTGloss_NET2Words.csv' -databaseFile = 'OpenGNT.csv' - -# export latest glosses - -f = open(inputFile,'r') -newData = f.read() -f.close() - -newData = re.sub('^.*?{([^{}]*?)}\t〈([^|]*?)|.*?$', r'\2\t\1*', newData, flags=re.M) -newData = re.sub('^.*?[^*]\n', '', newData, flags=re.M) - -f = open(outputFile,'w') -f.write(newData) -f.close() - -# insert latest glosses into database - -f = open(databaseFile,'r') -oldData = f.read() -f.close() - -newData = newData + oldData - -f = open(databaseFile,'w') -f.write(newData) -f.close() - -# sort data - -lines = open(databaseFile, 'r').readlines() -f = open(databaseFile, 'w') - -for line in sorted(lines, key=lambda line: line.split()[0]): - f.write(line) - -f.close() - -# merge glosses - -f = open(databaseFile,'r') -newData = f.read() -f.close() - -newData = re.sub('^.*?\t(.*?)*\n([^〔]*?〔[^〔]*?〔[^〔]*?〔[^〔]*?〔[^〔]*?〔[^〔]*?〔[^|]*?|[^|]*?|)([^|]*?|[^|]*?)〕', r'\2\1〕', newData, flags=re.M) - -f = open(databaseFile,'w') -f.write(newData) -f.close()