change jenkinsfile
This commit is contained in:
parent
1f65493332
commit
fca03bfe43
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -23,11 +23,19 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage("PythonScript")
|
||||||
|
{
|
||||||
|
steps{
|
||||||
|
sh label: '', script: 'python script.py'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage("Result")
|
stage("Result")
|
||||||
{
|
{
|
||||||
steps{
|
steps{
|
||||||
archiveArtifacts 'srr.txt'
|
archiveArtifacts 'srr.txt'
|
||||||
archiveArtifacts 'wer.txt'
|
archiveArtifacts 'wer.txt'
|
||||||
|
archiveArtifacts 'newresults.tsv'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Hello') {
|
stage('Hello') {
|
||||||
|
11
count.sh
11
count.sh
@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
MYFILE="wikiniews_results.tsv"
|
MYFILE="wikiniews_results.tsv"
|
||||||
COUNT_DIFF=0
|
COUNT=$(wc -l "$MYFILE" | awk '{print $1}')
|
||||||
COUNT=$(wc -l < "$MYFILE")
|
|
||||||
echo $COUNT
|
echo $COUNT
|
||||||
# create trn
|
# create trn
|
||||||
cut -f2 $MYFILE | awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' > hypothesis.trn
|
cut -f2 $MYFILE | awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' > hypothesis.trn
|
||||||
@ -10,7 +9,9 @@ cut -f3 $MYFILE | awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' > reference.tr
|
|||||||
|
|
||||||
#wer for each line
|
#wer for each line
|
||||||
sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout > wer.txt
|
sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout > wer.txt
|
||||||
diff hypothesis.trn reference.trn | grep "^>" | wc -l > $COUNT_DIFF
|
COUNT_DIFF=$(diff hypothesis.trn reference.trn | grep "^>" | wc -l)
|
||||||
|
echo $COUNT_DIFF
|
||||||
|
|
||||||
RESULT=`expr $COUNT_DIFF / $COUNT * 100`
|
let RESULT=$COUNT_DIFF/$COUNT
|
||||||
echo $RESULT > srr.text
|
echo $(echo "$COUNT_DIFF/$COUNT" | bc -l)
|
||||||
|
echo $(echo "$COUNT_DIFF/$COUNT" | bc -l) > srr.text
|
||||||
|
25
script.py
Normal file
25
script.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import csv
|
||||||
|
file = open("results.txt", "r")
|
||||||
|
|
||||||
|
scores = []
|
||||||
|
for f in file:
|
||||||
|
if "Scores" in f:
|
||||||
|
score = (f[22:].rstrip("\n").split(" "))
|
||||||
|
score = (int(score[1])+int(score[2])+int(score[3]))/(int(score[0])+int(score[1])+int(score[2]))
|
||||||
|
scores.append(round(score,2))
|
||||||
|
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
with open('wikiniews_results.tsv','r') as f_in:
|
||||||
|
with open('newresult.tsv', 'w') as f_out:
|
||||||
|
writer = csv.writer(f_out, delimiter=' ', lineterminator='\n')
|
||||||
|
reader = csv.reader(f_in, delimiter='\t')
|
||||||
|
|
||||||
|
result = []
|
||||||
|
|
||||||
|
for row,score in zip(reader, scores):
|
||||||
|
# add new column values
|
||||||
|
row.append('\t'+str(score))
|
||||||
|
result.append(row)
|
||||||
|
|
||||||
|
writer.writerows(result)
|
Loading…
Reference in New Issue
Block a user