| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # This script rebuilds the database according to the new set of |
| 4 | # classification rules provided in the file lexicon.rules and tries |
| 5 | # to handle correctly possible moving entries between dictionaries. |
| 6 | # The words that were forcibly treated as the explicit entries |
| 7 | # during the process are collected in the file explicit.list |
| 8 | # and can be inspected afterwards. |
| 9 | |
| 10 | echoscip-shell system . . echo. "Extracting original dictionaries" |
| 11 | ../src/lexholder -f implicit.dict -M -l lexicon |
| 12 | ../src/lexholder -f explicit.dict -X -l lexicon |
| 13 | |
| 14 | echoscip-shell system . . echo. "Building temporary database for further comparison" |
| 15 | ../src/lexholder -f implicit.dict -X lexicon.tmp |
| 16 | |
| 17 | echoscip-shell system . . echo. "Reinserting explicit dictionary" |
| 18 | ../src/lexholder -D -X lexicon |
| 19 | ../src/lexholder -f explicit.dict lexicon |
| 20 | |
| 21 | echoscip-shell system . . echo. "Extracting new implicit dictionary" |
| 22 | ../src/lexholder -f lexicon.dump -M -l lexicon |
| 23 | |
| 24 | echoscip-shell system . . echo. "Finding the words to be moved from implicit dictionary to the explicit one" |
| 25 | while read key value |
| 26 | do ../src/lexholder -q -s $key -x lexicon.tmp || echoscip-shell system . . echo. "$key $value" |
| 27 | done <lexicon.dump >explicit.list |
| 28 | rmscip-shell system . . rm. -f lexicon.tmp |
| 29 | |
| 30 | echoscip-shell system . . echo. "Rebuilding the database according to the new rules" |
| 31 | ../src/lexholder -D -X lexicon |
| 32 | ../src/lexholder -D -M lexicon |
| 33 | ../src/lexholder -f lexicon.rules -L -r lexicon |
| 34 | ../src/lexholder -f implicit.dict -M lexicon |
| 35 | ../src/lexholder -f explicit.dict lexicon |
| 36 | |
| 37 | echoscip-shell system . . echo. "Moving some words from implicit dictionary to the explicit one" |
| 38 | while read key value |
| 39 | do ../src/lexholder -d $key -M lexicon |
| 40 | done <explicit.list |
| 41 | ../src/lexholder -f explicit.list -X lexicon |
| 42 | |
| 43 | echoscip-shell system . . echo. "All done" |
| 44 | echoscip-shell system . . echo. "All the words that were forced to be treated as explicit" |
| 45 | echoscip-shell system . . echo. "are now listed in the file explicit.list." |