Last change
on this file since f924e4b was
555c7f8,
checked in by Tomasz Obrebski <to@…>, 12 years ago
|
dodanie mo�liwo�ci szybkiego uaktualniania s�ownika dla lema
|
-
Property mode set to
100755
|
File size:
1.0 KB
|
Rev | Line | |
---|
[555c7f8] | 1 | #! /bin/bash |
---|
| 2 | |
---|
| 3 | if [ $# -lt 2 ] |
---|
| 4 | then |
---|
| 5 | echo "Usage:" |
---|
| 6 | echo " compdic-update-cats <catfile> <difference> <difference> ..." |
---|
| 7 | echo "where" |
---|
| 8 | echo " <catfile> - file containing the list morphosyntactic categories" |
---|
| 9 | echo " <difference> - diff-format file containing lines to be added to/removed from dictionary" |
---|
| 10 | exit 0 |
---|
| 11 | fi |
---|
| 12 | |
---|
| 13 | tempdir=`mktemp -d /tmp/compdic.XXXXXX` |
---|
| 14 | |
---|
| 15 | cats=$1 |
---|
| 16 | shift |
---|
| 17 | |
---|
| 18 | catplus=$tempdir/plus.cat |
---|
| 19 | catminus=$tempdir/minus.cat |
---|
| 20 | cattmp=$tempdir/tmp.cat |
---|
| 21 | |
---|
| 22 | touch $catplus |
---|
| 23 | touch $catminus |
---|
| 24 | |
---|
| 25 | while (($#)) |
---|
| 26 | do |
---|
| 27 | echo processing $1 ... |
---|
| 28 | cat $1 | egrep '^>' | sed -r 's/^> *//;s/[[:space:]].*$//' | cut -d ',' -f 2 | sort -u | canonize >> $catplus |
---|
| 29 | cat $1 | egrep '^<' | sed -r 's/^< *//;s/[[:space:]].*$//' | cut -d ',' -f 2 | sort -u | canonize >> $catminus |
---|
| 30 | shift |
---|
| 31 | done |
---|
| 32 | |
---|
| 33 | echo updating $cats ... |
---|
| 34 | # comm -23 $cats $catminus > $cattmp |
---|
| 35 | # mv ${cats} ${cats}~ |
---|
| 36 | # cat $cattmp $catplus | sort -u > $cats |
---|
| 37 | |
---|
| 38 | cat $cats $catplus | sort -u > $cattmp |
---|
| 39 | |
---|
| 40 | mv ${cats} ${cats}~ |
---|
| 41 | mv ${cattmp} ${cats} |
---|
| 42 | chmod a+r ${cats} |
---|
| 43 | |
---|
| 44 | rm -r $tempdir |
---|
Note: See
TracBrowser
for help on using the repository browser.