commit fb7d691f8c1a8e99b58e7fbcd176a7805543788e Author: aboelhamd Date: Fri May 31 15:31:51 2019 +0200 Script to remove bad sentences diff --git a/rem-bad-sents.py b/rem-bad-sents.py new file mode 100644 index 0000000..ad2e263 --- /dev/null +++ b/rem-bad-sents.py @@ -0,0 +1,26 @@ +import sys + +if (len(sys.argv) != 4) : + print('\nUsage: python rem-bad-sents.py source-file ambig-target-file new-source-file'); + sys.exit() + +srcFile = open(sys.argv[1], 'r') +ambigTarFile = open(sys.argv[2], 'r') +newSrcFile = open(sys.argv[3], 'w+') + +sents = [] + +for sent in ambigTarFile: + if (sent.strip()) : + sents.append(sent) + + else : + src = scrFile.readline() + for sent in sents : + if (line.find("#") == -1 and line.find("@") == -1) : + newSrcFile.write() + sents.clear() + +srcFile.close() +ambigTarFile.close() +newSrcFile.close()