This commit is contained in:
Bartosz Szukała 2019-05-17 11:21:20 +02:00
parent 852109f1b1
commit 7c6b25fff8
4 changed files with 53 additions and 33 deletions

View File

@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="23c64b1c-6fb1-4de9-b08e-40eaad3cd972" name="Default Changelist" comment=""> <list default="true" id="23c64b1c-6fb1-4de9-b08e-40eaad3cd972" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/counter.sh" beforeDir="false" afterPath="$PROJECT_DIR$/counter.sh" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wer.py" beforeDir="false" afterPath="$PROJECT_DIR$/wer.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/wer.py" beforeDir="false" afterPath="$PROJECT_DIR$/wer.py" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -41,26 +42,26 @@
<entry key="Dockerfile" value="1" /> <entry key="Dockerfile" value="1" />
<entry key="Jenkinsfile" value="4" /> <entry key="Jenkinsfile" value="4" />
<entry key="dummy" value="6" /> <entry key="dummy" value="6" />
<entry key="py" value="56" /> <entry key="py" value="65" />
<entry key="sh" value="16" /> <entry key="sh" value="20" />
</counts> </counts>
</usages-collector> </usages-collector>
<usages-collector id="statistics.file.types.edit"> <usages-collector id="statistics.file.types.edit">
<counts> <counts>
<entry key="Dockerfile" value="1" /> <entry key="Dockerfile" value="1" />
<entry key="PLAIN_TEXT" value="26" /> <entry key="PLAIN_TEXT" value="30" />
<entry key="Python" value="56" /> <entry key="Python" value="65" />
</counts> </counts>
</usages-collector> </usages-collector>
</session> </session>
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/wer.py"> <entry file="file://$PROJECT_DIR$/wer.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425"> <state relative-caret-position="391">
<caret line="25" column="16" lean-forward="true" selection-start-line="25" selection-start-column="16" selection-end-line="25" selection-end-column="16" /> <caret line="23" column="20" selection-start-line="23" selection-start-column="11" selection-end-line="23" selection-end-column="20" />
<folding> <folding>
<element signature="e#0#9#0" expanded="true" /> <element signature="e#0#9#0" expanded="true" />
</folding> </folding>
@ -71,17 +72,17 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/counter.sh"> <entry file="file://$PROJECT_DIR$/counter.sh">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51"> <state relative-caret-position="85">
<caret line="3" column="94" lean-forward="true" selection-start-line="3" selection-start-column="94" selection-end-line="3" selection-end-column="94" /> <caret line="5" column="28" lean-forward="true" selection-start-line="5" selection-start-column="28" selection-end-line="5" selection-end-column="28" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Jenkinsfile"> <entry file="file://$PROJECT_DIR$/Jenkinsfile">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51"> <state relative-caret-position="238">
<caret line="3" column="19" selection-start-line="3" selection-start-column="15" selection-end-line="3" selection-end-column="19" /> <caret line="14" column="30" selection-start-line="14" selection-start-column="30" selection-end-line="14" selection-end-column="30" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -110,10 +111,10 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/Jenkinsfile" />
<option value="$PROJECT_DIR$/counter.sh" />
<option value="$PROJECT_DIR$/Dockerfile" /> <option value="$PROJECT_DIR$/Dockerfile" />
<option value="$PROJECT_DIR$/wer.py" /> <option value="$PROJECT_DIR$/wer.py" />
<option value="$PROJECT_DIR$/counter.sh" />
<option value="$PROJECT_DIR$/Jenkinsfile" />
</list> </list>
</option> </option>
</component> </component>
@ -213,7 +214,7 @@
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="Favorites" side_tool="true" /> <window_info id="Favorites" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" /> <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Docker" show_stripe_button="false" /> <window_info anchor="bottom" id="Docker" show_stripe_button="false" />
<window_info anchor="bottom" id="Database Changes" show_stripe_button="false" /> <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
@ -223,7 +224,7 @@
<window_info anchor="bottom" id="Event Log" side_tool="true" /> <window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" /> <window_info anchor="bottom" id="Find" order="1" />
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.329718" /> <window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.329718" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@ -247,8 +248,18 @@
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/counter.sh"> <entry file="file://$PROJECT_DIR$/counter.sh">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51"> <state relative-caret-position="85">
<caret line="3" column="94" lean-forward="true" selection-start-line="3" selection-start-column="94" selection-end-line="3" selection-end-column="94" /> <caret line="5" column="28" lean-forward="true" selection-start-line="5" selection-start-column="28" selection-end-line="5" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/wer.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391">
<caret line="23" column="20" selection-start-line="23" selection-start-column="11" selection-end-line="23" selection-end-column="20" />
<folding>
<element signature="e#0#9#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -261,18 +272,8 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Jenkinsfile"> <entry file="file://$PROJECT_DIR$/Jenkinsfile">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51"> <state relative-caret-position="238">
<caret line="3" column="19" selection-start-line="3" selection-start-column="15" selection-end-line="3" selection-end-column="19" /> <caret line="14" column="30" selection-start-line="14" selection-start-column="30" selection-end-line="14" selection-end-column="30" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/wer.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<caret line="25" column="16" lean-forward="true" selection-start-line="25" selection-start-column="16" selection-end-line="25" selection-end-column="16" />
<folding>
<element signature="e#0#9#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>

2
Jenkinsfile vendored
View File

@ -12,7 +12,7 @@ doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg:
'https://git.wmi.amu.edu.pl/s421813/s421813-mlworkshops.git']]]) 'https://git.wmi.amu.edu.pl/s421813/s421813-mlworkshops.git']]])
sh label: '', script: 'chmod 777 counter.sh' sh label: '', script: 'chmod 777 counter.sh'
sh label: '', script: './counter.sh' sh label: '', script: './counter.sh'
archiveArtifacts 'out.txt' archiveArtifacts 'WerSrrOut.txt'
archiveArtifacts 'wikiniews_results.tsv' archiveArtifacts 'wikiniews_results.tsv'
} }

View File

@ -2,3 +2,5 @@ awk 'BEGIN { FS="\t" } {print gensub("^\\*\\*", "\\\\**", "g", $2) "\t(sp1_"NR")
awk 'BEGIN { FS="\t" } {print gensub("^\\*\\*", "\\\\**", "g", $3) "\t(sp1_"NR")"}' wikiniews_results.tsv > hypothesis.trn awk 'BEGIN { FS="\t" } {print gensub("^\\*\\*", "\\\\**", "g", $3) "\t(sp1_"NR")"}' wikiniews_results.tsv > hypothesis.trn
rm out.txt rm out.txt
sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout >> out.txt sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout >> out.txt
python wer.py
mv metrics_results.tsv wikiniews_results.tsv

17
wer.py
View File

@ -24,3 +24,20 @@ srr = corrects / len(allWer)
with open("WerSrrOut.txt", "w") as file: with open("WerSrrOut.txt", "w") as file:
file.write("WER average: " + str(werAvg) + '\n' + "Sentence recognition rate: " + str(srr)) file.write("WER average: " + str(werAvg) + '\n' + "Sentence recognition rate: " + str(srr))
file.close() file.close()
x = 0
with open("wikiniews_results.tsv", 'r', encoding="utf-8") as insert:
with open("metrics_results.tsv", 'w', encoding="utf-8") as out:
file_out = csv.writer(out, delimiter='\t', lineterminator='\n')
file_in = csv.reader(insert, delimiter='\t')
result = []
for row in file_in:
row.append(allWer[x])
result.append(row)
x += 1
file_out.writerows(result)