Andley_OGNTa/obsolete scripts/Trim OGNTa.py

70 lines
2.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# trim original OGNT to mininum data
import re
# ══════ trim interlinear ═══════════════════════
inputFile = "./source/OpenGNT_version3_3.csv"
outputFile = "./OGNTa-LN.txt"
# Trimming OGNT to minimum dataset required for interlinear
# 1-OGNTsort 2-TANTTsort 3-FEATURESsort1- 4-LevinsohnClauseID 5-OTquotation 6-BGBsortI7-LTsortI8-STsortI 9-Book10-Chapter11-Verse 12-OGNTk13-OGNTu14-OGNTa15-lexeme16-rmac17-sn 18-BDAGentry19-EDNTentry20-MounceEntry21-GoodrickKohlenbergerNumbers22-LN-LouwNidaNumbers 23-transSBLcap24-transSBL25-modernGreek26-Fonética_Transliteración 27-TBESG28-IT29-LT30-ST31-Español 32-PMpWord33-PMfWord 34-Note35-Mvar36-Mlexeme37-Mrmac38-Msn39-MTBESG
f = open(inputFile,'r',encoding="utf-8")
Lines = f.readlines()[1:]
f.close()
f = open(outputFile,'w',encoding="utf_8_sig")
for line in Lines:
#print (line)
line = line.replace('\t','\t')
line = line.replace('\t','\t')
line = line.replace('','\t')
x = re.split("\t", line)
#
x[27] = x[27].replace(',','')
x[27] = x[27].replace(';','')
x[27] = x[27].replace('.','')
x[27] = x[27].replace('','')
x[27] = x[27].replace(':','')
#
x[31] = x[31].replace('<pm>','')
x[31] = x[31].replace('</pm>','')
x[31] = x[31].replace('[[','')
x[32] = x[32].replace('<pm>','')
x[32] = x[32].replace('</pm>','')
x[32] = x[32].replace(']]','')
#
x[8] = x[8].replace('40', 'Mat')
x[8] = x[8].replace('41', 'Mar')
x[8] = x[8].replace('42', 'Luk')
x[8] = x[8].replace('43', 'Joh')
x[8] = x[8].replace('44', 'Act')
x[8] = x[8].replace('45', 'Rom')
x[8] = x[8].replace('46', '1Co')
x[8] = x[8].replace('47', '2Co')
x[8] = x[8].replace('48', 'Gal')
x[8] = x[8].replace('49', 'Eph')
x[8] = x[8].replace('50', 'Php')
x[8] = x[8].replace('51', 'Col')
x[8] = x[8].replace('52', '1Th')
x[8] = x[8].replace('53', '2Th')
x[8] = x[8].replace('54', '1Ti')
x[8] = x[8].replace('55', '2Ti')
x[8] = x[8].replace('56', 'Tit')
x[8] = x[8].replace('57', 'Phm')
x[8] = x[8].replace('58', 'Heb')
x[8] = x[8].replace('59', 'Jas')
x[8] = x[8].replace('60', '1Pe')
x[8] = x[8].replace('61', '2Pe')
x[8] = x[8].replace('62', '1Jo')
x[8] = x[8].replace('63', '2Jo')
x[8] = x[8].replace('64', '3Jo')
x[8] = x[8].replace('65', 'Jud')
x[8] = x[8].replace('66', 'Rev')
#
#f.write (x[0]+'\t'+x[8]+' '+x[9]+':'+x[10]+'\t'+x[31]+x[13]+x[32]+'\t'+x[14]+'\t'+x[21]+'\t'+x[15]+'\t'+x[27]+'\n')
f.write (x[21]+'\n')
f.close()