Commit 9e6c798c authored by Pärtel Lippus's avatar Pärtel Lippus

skript, mis teeb korpuse seisust tabeliga kokkuvõtte: märgenduskihid, kestused

parent f2d6364d
# arvutab korpuse segmentide arvu ja märgendatud failide kestused
path$ = readFile$ (preferencesDirectory$ + "/plugin_KorpuseHaldus/korpuse_kataloog.txt")
Create Table with column names: "segm", 0, "stiil fail dur hms sõnad häälikud silbid taktid morf häälelaad silbikiht taktikiht komm"
Read from file: "'path$'EKSKFK_avalik_nousolek.Table"
ridu = Get number of rows
for r to ridu
select Table EKSKFK_avalik_nousolek
stiil$ = Get value: r, "stiil"
fail$ = Get value: r, "fail"
start = Get value: r, "start"
silbikiht$ = Get value: r, "silbikiht"
taktikiht$ = Get value: r, "taktikiht"
Read from file: "'path$'SKK'stiil$'/'fail$'.TextGrid"
dur = Get total duration
hms$ = string$(dur div 3600) + ":" + string$((dur mod 3600) div 60) + ":" + string$(round((dur mod 3600) mod 60))
select Table segm
Append row
Set string value: r, "stiil", stiil$
Set string value: r, "fail", fail$
Set numeric value: r, "dur", dur
Set string value: r, "hms", hms$
Set string value: r, "silbikiht", silbikiht$
Set string value: r, "taktikiht", taktikiht$
if start <> undefined
select TextGrid 'fail$'
kihte = Get number of tiers
for k to kihte
select TextGrid 'fail$'
kiht$ = Get tier name: k
intd = Get number of intervals: k
if index("sõnad häälikud silbid taktid morf häälelaad", kiht$) > 0
select Table segm
Set numeric value: r, kiht$, intd
elsif kiht$ = "CV"
select Table segm
haalikud = Get value: r, "häälikud"
if haalikud <> intd
Set string value: r, "komm", "häälikud<>CV!!!"
endif
endif
endfor
else
select Table segm
Set string value: r, "komm", "märgendamata"
endif
select TextGrid 'fail$'
Remove
endfor
Create Table with column names: "summary", 0, "stiil dur durHääl durSyl durTakt sõnad häälikud silbid taktid morf häälelaad"
Append row
sumR = 1
Set string value: sumR, "stiil", "kokku"
select Table segm
@summarize
# dialoogid
select Table summary
Append row
sumR += 1
Set string value: sumR, "stiil", "dialoogid"
select Table segm
Extract rows where column (number): "stiil", "not equal to", 1
Rename: "temp"
@summarize
select Table temp
Remove
# allkorpuste kaupa
for korp from 0 to 2
select Table summary
Append row
sumR += 1
Set string value: sumR, "stiil", "SKK'korp'"
select Table segm
Extract rows where column (number): "stiil", "equal to", korp
Rename: "temp"
@summarize
select Table temp
Remove
endfor
select Table EKSKFK_avalik_nousolek
Remove
procedure summarize
ridu = Get number of rows
durTotal = 0
durHaal = 0
durSyl = 0
durTakt = 0
sonaTot = 0
hTot = 0
sylTot = 0
taktTot = 0
morfTot = 0
hlTot = 0
for r to ridu
dur = Get value: r, "dur"
if dur <> undefined
durTotal += dur
endif
sona = Get value: r, "sõnad"
if sona <> undefined
sonaTot += sona
endif
h = Get value: r, "häälikud"
if h <> undefined
hTot += h
durHaal += dur
endif
syl = Get value: r, "silbid"
silbikiht$ = Get value: r, "silbikiht"
if syl <> undefined
sylTot += syl
if silbikiht$ = "ok"
durSyl += dur
endif
endif
takt = Get value: r, "taktid"
taktikiht$ = Get value: r, "taktikiht"
if takt <> undefined
taktTot += takt
if taktikiht$ = "ok"
durTakt += dur
endif
endif
morf = Get value: r, "morf"
if morf <> undefined
morfTot += morf
endif
hl = Get value: r, "häälelaad"
if hl <> undefined
hlTot += hl
endif
endfor
durTotal$ = string$(durTotal div 3600) + ":" + string$((durTotal mod 3600) div 60) + ":" + string$(round((durTotal mod 3600) mod 60))
durHaal$ = string$(durHaal div 3600) + ":" + string$((durHaal mod 3600) div 60) + ":" + string$(round((durHaal mod 3600) mod 60))
durSyl$ = string$(durSyl div 3600) + ":" + string$((durSyl mod 3600) div 60) + ":" + string$(round((durSyl mod 3600) mod 60))
durTakt$ = string$(durTakt div 3600) + ":" + string$((durTakt mod 3600) div 60) + ":" + string$(round((durTakt mod 3600) mod 60))
select Table summary
Set string value: sumR, "dur", durTotal$
Set string value: sumR, "durHääl", durHaal$
Set string value: sumR, "durSyl", durSyl$
Set string value: sumR, "durTakt", durTakt$
Set numeric value: sumR, "sõnad", sonaTot
Set numeric value: sumR, "häälikud", hTot
Set numeric value: sumR, "silbid", sylTot
Set numeric value: sumR, "taktid", taktTot
Set numeric value: sumR, "morf", morfTot
Set numeric value: sumR, "häälelaad", hlTot
endproc
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment