source: src/compdic/compdic-update-cats @ f924e4b

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
Line 
1#! /bin/bash
2
3if [ $# -lt 2 ]
4then
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
11fi     
12
13tempdir=`mktemp -d /tmp/compdic.XXXXXX`
14
15cats=$1
16shift
17
18catplus=$tempdir/plus.cat
19catminus=$tempdir/minus.cat
20cattmp=$tempdir/tmp.cat
21
22touch $catplus
23touch $catminus
24
25while (($#))
26do
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
31done
32
33echo updating $cats ...
34# comm -23 $cats $catminus > $cattmp
35# mv ${cats} ${cats}~
36# cat $cattmp $catplus | sort -u > $cats
37
38cat $cats $catplus | sort -u > $cattmp
39
40mv ${cats} ${cats}~
41mv ${cattmp} ${cats}
42chmod a+r ${cats}
43
44rm -r $tempdir
Note: See TracBrowser for help on using the repository browser.