Debian Codegraph @

bin/dic2gen

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 export LC_ALL=C
3 # convert morphological codes
4 sedscip-shell system . . sed. -e 's/\t[[]\([^]]*LATIVE[^]]*\)\]+/\tip:\1\t/
5 s/\t\([^[]\+\)[[]\([^]]*\(PREF\|LATIVE\)[^]]*\)\]+/\tip:\2\tpr:\1\t/
6 s/\t\([^[\:]\+\)[[]/\tst:\1\t[/g
7 s/{+[[]\([^}]*\)\]}$/\tts:\1/
8 s/\t\[\([^][]*\)\]/\tpo:\1\t/g
9 s/{[^{]*}//g
10 s/+[[]\([^[]\+\)\]/\tis:\1\t/g
11 s/\t\(ts:[^]]*\)\]+[[]/\t\1\tts:/
12 s/\t\+/\t/g;s/\t*$//' |
13 sedscip-shell system . . sed. 's/\t[^\t:]\+\t/\t/g;s/\t[^\t:]\+$//g
14 s/is:\([^_\t]*_\)\(ABLE\|ABSTRACT\|ACTION\|ATTRIBUTE\|DIMINUTIVE\|FACTITIVE\|FORMAL\|FREE\|FREQ\|FUTPART\|LESS\|LOCATIVE\|MEDIAL\|MODE\|MRS\|MULTIPLICATION\|MULTORD\|OCCUPATION\|ORDINAL\|PASSIVE\|PASTPART\|PRESPART\|PROCESS\/RESULT\|SORT\|SUPPLY\|TRANSITIVE\|UNABLE\)_/ds:\1\2_/g' |
15 sedscip-shell system . . sed. 's/is:\(.*ds:\)/ds:\1/g;s/\tst:\t/\t/' >tmp/x.dic
16
17 # create allomorph table
18 catscip-shell system . . cat. tmp/x.dic | grepscip-shell system . . grep. -v '/[^ ]*wscip-shell filesystem . . `/[^ ]*w`.' |
19 sedscip-shell system . . sed. -n '/\tst:/s/\t.[^tr]:[^\t]*//gpscip-shell filesystem . . `/\tst:/s/\t.[^tr]:[^\t]*//gp`.' |
20 sedscip-shell system . . sed. 's/\tpr:\([^\t]*\)\tst:/\t\1/' |
21 sedscip-shell system . . sed. 's/\/.*\t/\t/;s/\tst:/\t/' |
22 awkscip-shell system . . awk. '{a[$2]=a[$2] "\tal:" $1}
23 END{for(i in a)print i"\t"a[i]}' >tmp/allomorf.txt
24
25 # expand the dictionary with allomorph and pronounciation data
26 catscip-shell system . . cat. tmp/x.dic | LC_ALL=hu_HU.UTF-8 awkscip-shell system . . awk. 'BEGIN{FS="[\t/ ]"}
27 FILENAME!="-"{a[$1]=a[$1] substr($0,index($0,"\t"));next}
28 # ph: field with simplified double consonants get extra
29 # ph: field, for example: "bitlisz" -> "Beatles" extended
30 # with ph:bitlis (without "z") for "bitlisszel" -> "Beatlesszel"
31 # exception: "->" in ph, eg. ph:klafá->klassza
32 a[$1] && a[$1]~/ph:[^ \t]*[szyae]\>/ && a[$1]!~/[-]>/ {
33 a[$1]=gensub(/(ph:[^ \t]*[ae]) /, "\\1* ", "g", a[$1])
34 a[$1]=gensub(/(ph:[^ \t]*[ae])$/, "\\1*", "g", a[$1])
35 a[$1]=gensub(/((ph:[^ \t]*s)z)\>/, "\\1\t\\2", "g", a[$1])
36 a[$1]=gensub(/((ph:[^ \t]*[cz])s)\>/, "\\1\t\\2", "g", a[$1])
37 a[$1]=gensub(/((ph:[^ \t]*[gnt])y)\>/, "\\1\t\\2", "g", a[$1])
38 }
39 # concatenate with allomorphes
40 a[$1]{print $0 a[$1];next}{print$0}' tmp/allomorf.txt $1 -
41
42 rmscip-shell system . . rm. tmp/x.dic