jenkinsfile
This commit is contained in:
parent
1a63b463f5
commit
dc7a4aa903
@ -1,4 +1,5 @@
|
|||||||
import re
|
import re
|
||||||
|
import csv
|
||||||
|
|
||||||
wer = open("wer.txt","w")
|
wer = open("wer.txt","w")
|
||||||
ssr = open("ssr.txt","w")
|
ssr = open("ssr.txt","w")
|
||||||
@ -10,6 +11,10 @@ counter = 0
|
|||||||
|
|
||||||
ssrCounter = 0
|
ssrCounter = 0
|
||||||
|
|
||||||
|
inputLines = ""
|
||||||
|
|
||||||
|
werArray = []
|
||||||
|
|
||||||
with open("helper.txt", "r") as f:
|
with open("helper.txt", "r") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
if re.match(r'^id:.*', line):
|
if re.match(r'^id:.*', line):
|
||||||
@ -22,9 +27,31 @@ with open("helper.txt", "r") as f:
|
|||||||
ssrCounter += 1
|
ssrCounter += 1
|
||||||
globalPercent += sum
|
globalPercent += sum
|
||||||
counter += 1
|
counter += 1
|
||||||
|
werArray.append(sum)
|
||||||
wer.write(lastId + " = " + str(sum) + "%\n")
|
wer.write(lastId + " = " + str(sum) + "%\n")
|
||||||
|
|
||||||
wer.write("AVG: " + str(float((globalPercent) / (float(counter) * 100)*100)) + "%")
|
wer.write("AVG: " + str(float((globalPercent) / (float(counter) * 100)*100)) + "%")
|
||||||
ssr.write(str(float(ssrCounter)/float(counter) * 100) + "%")
|
ssr.write(str(float(ssrCounter)/float(counter) * 100) + "%")
|
||||||
wer.close()
|
wer.close()
|
||||||
ssr.close()
|
ssr.close()
|
||||||
|
|
||||||
|
|
||||||
|
with open('wikiniews_results.tsv','r') as f_in:
|
||||||
|
with open('wikiniews_results2.tsv', 'w') as f_out:
|
||||||
|
writer = csv.writer(f_out, delimiter=' ', lineterminator='\n')
|
||||||
|
reader = csv.reader(f_in, delimiter=' ')
|
||||||
|
|
||||||
|
result = []
|
||||||
|
# read headers
|
||||||
|
row = next(reader)
|
||||||
|
# add new header to list of headers
|
||||||
|
row.append('Col5')
|
||||||
|
result.append(row)
|
||||||
|
counter = 0
|
||||||
|
for row in reader:
|
||||||
|
# add new column values
|
||||||
|
row.append(werArray[counter])
|
||||||
|
counter += 1
|
||||||
|
result.append(row)
|
||||||
|
|
||||||
|
writer.writerows(result)
|
@ -10,7 +10,6 @@ sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all std
|
|||||||
|
|
||||||
python ./createWERandSRRFiles.py
|
python ./createWERandSRRFiles.py
|
||||||
|
|
||||||
head -5 ssr.txt
|
|
||||||
head -250 wer.txt
|
head -250 wer.txt
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user