]> git.pld-linux.org Git - packages/dict-mueller24.git/commitdiff
- converted tool and dictionary to utf-8 master auto/th/dict-mueller24-1.6-4
authorJan Rękorajski <baggins@pld-linux.org>
Wed, 29 Jan 2014 07:22:17 +0000 (08:22 +0100)
committerJan Rękorajski <baggins@pld-linux.org>
Wed, 29 Jan 2014 07:22:17 +0000 (08:22 +0100)
- rel 4

dict-mueller24.spec
to-dict [new file with mode: 0644]

index 8d37ce370c3aca61912580e1037a422e1a5046c5..5380a766a3b700907b40761eca67fc6ef1dc20be 100644 (file)
@@ -3,18 +3,17 @@ Summary:      English-Russian dictionary for dictd
 Summary(pl.UTF-8):     Słownik angielsko-rosyjski dla dictd
 Name:          dict-%{dictname}
 Version:       1.6
-Release:       3
+Release:       4
 License:       unknown
 Group:         Applications/Dictionaries
 Source0:       http://mueller-dic.chat.ru/Mueller24.tgz
 # Source0-md5: 386d71c149f3f793d3ff064fd4b16c65
-# This one is compressed with szip: http://www.compressconsult.com/szip
-#Source0:      http://www.geocities.com/mueller_dic/Mueller24.tgz
-Source1:       http://www.math.sunysb.edu/~comech/tools/to-dict
-# Source1-md5: 3c1b69c290fb4c06bf3456baf5bf8b97
+#Source1:      http://www.math.sunysb.edu/~comech/tools/to-dict
+Source1:       to-dict
 URL:           http://mueller-dic.chat.ru/
 BuildRequires: dictfmt
 BuildRequires: dictzip
+BuildRequires: iconv
 BuildRequires: rpmbuild(macros) >= 1.268
 Requires:      %{_sysconfdir}/dictd
 Requires:      dictd
@@ -34,8 +33,10 @@ cp %{SOURCE1} .
 chmod +x ./to-dict
 
 %build
-./to-dict --src-data usr/local/share/dict/Mueller24.koi mueller24.data
-./to-dict --data-dict mueller24.data mueller24 && rm -f mueller24.data
+iconv -f koi8-r -t utf-8 usr/local/share/dict/Mueller24.koi >usr/local/share/dict/Mueller24.utf8
+iconv -f koi8-r -t utf-8 usr/local/share/mova/Mueller24_koi.txt >usr/local/share/mova/Mueller24_utf8.txt
+LC_ALL=ru_RU.utf-8 ./to-dict --src-data usr/local/share/dict/Mueller24.utf8 mueller24.data
+LC_ALL=ru_RU.utf-8 ./to-dict --data-dict mueller24.data mueller24 && rm -f mueller24.data
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -63,6 +64,6 @@ fi
 %files
 %defattr(644,root,root,755)
 %doc usr/local/share/mova/Mueller24.txt
-%lang(ru) %doc usr/local/share/mova/Mueller24_koi.txt
+%lang(ru) %doc usr/local/share/mova/Mueller24_utf8.txt
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dictd/%{dictname}.dictconf
 %{_datadir}/dictd/%{dictname}.*
diff --git a/to-dict b/to-dict
new file mode 100644 (file)
index 0000000..b2b4e3c
--- /dev/null
+++ b/to-dict
@@ -0,0 +1,194 @@
+#!/bin/sh
+# A shell script for conversion of MOVA MuellerXX.koi dictionaries 
+# into DICT format. 
+# Written by Andrew Comech <comech@math.sunysb.edu>
+# GNU GPL (2000)
+# The latest version is available from
+# http://www.math.sunysb.edu/~comech/tools/to-dict
+
+version="0.1"
+versiondate="November 11, 2000"
+
+# We need the following binaries:
+DICTFMT=`which dictfmt`
+DICTZIP=`which dictzip`
+
+INFO () {
+  echo "
+to-dict, version $version ($versiondate).
+Conversion of MOVA MuellerXX.koi dictionaries into DICT format.
+Written by Andrew Comech <comech@math.sunysb.edu>. GNU GPL (2000)
+
+The latest version is available from
+http://www.math.sunysb.edu/~comech/tools/to-dict
+"
+}
+
+REQUIREMENTS () {
+  echo "
+REQUIREMENTS: you need the binaries \`dictfmt' and \`dictzip'. 
+
+dictzip.c can be found in dictd-1.5.0.tar.gz (or later version) at
+ftp://ftp.cs.unc.edu/pub/users/faith/dict/
+
+dictfmt.c can be found in Debian/GNU Linux package dict-elements at
+ftp://ftp.debian.org/debian/dists/potato/main/source/text/
+
+Compiled binaries (dictfmt and dictzip) could be downloaded from
+http://www.wh9.tu-dresden.de/~heinrich/dict/dict_leo_ftp/static-binaries/
+or
+http://iris.ltas.ulg.ac.be/download/apps/dict/
+"
+}
+
+USAGE () {
+    echo "
+USAGE: 
+ -version: show version
+ -h, --help, or no parameters: show this help
+
+(*) To make DICT database from Mueller7GPL.koi available from
+http://www.chat.ru/~mueller_dic/Mueller7GPL.tgz
+
+# Remove transcription:
+./to-dict --no-trans Mueller7GPL.koi mueller7.notr
+# Convert <source> into <data> (a file with %h, %d-headers):
+./to-dict --src-data mueller7.notr mueller7.data && rm -i mueller7.notr
+# Convert <data> into DICT-format (files <name>.dict.dz and <name>.index):
+./to-dict --data-dict mueller7.data mueller7 && rm -i mueller7.data
+# Expand index file (to be able to access lines like \"A, a\" by \"A\" and \"a\"):
+./to-dict --expand-index mueller7.index mueller7.index.exp
+# Install a new dictionary with expanded index (RUN AS ROOT).
+# The location of files may depend on your distribution!!!
+cp mueller7.dict.dz /usr/share/dictd/mueller7.dict.dz
+cp mueller7.index.exp /usr/share/dictd/mueller7.index
+dictdconfig -w && (killall dictd; dictd)
+
+(*) To make DICT database from Mueller24.koi available from 
+http://www.chat.ru/~mueller_dic/Mueller24.tgz (this one is preferred)
+
+# Convert <source> into <data> (a file with %h, %d):
+./to-dict --src-data Mueller24.koi mueller24.data
+# Convert <data> into DICT-format (files <name>.dict.dz and <name>.index):
+./to-dict --data-dict mueller24.data mueller24 && rm -i mueller24.data
+# Install a new dictionary with expanded index (RUN AS ROOT).
+# The location of files may depend on your distribution!!!
+cp mueller24.dict.dz /usr/share/dictd/mueller24.dict.dz
+cp mueller24.index /usr/share/dictd/mueller24.index
+dictdconfig -w && (killall dictd; dictd)
+
+(*) To re-convert <dict> into <data> (a file with %h, %d-headers):
+
+./to-dict --dict-data <dict> <data>
+
+ *************************************************************
+    !!WARNING!!    !!WARNING!!    !!WARNING!!    !!WARNING!!   
+
+ Temporary files created by this script occupy a lot of drive space!
+ 15 MB for Mueller7GPL.koi (have to strip off transcription first)
+ 12 MB for Mueller24.koi
+ *************************************************************
+"
+}
+
+# To remove the transcription except for [r] and [ju:] which found in the text. 
+# This procedure should not change Mueller24.koi if applied to it.
+NO_TRANS () {
+sed 's/как\ \[juЫ\]/как\ "ju:"/; s/\[l\],/"l",/g; s/\[r\]/"r"/g; s/\], \[/A/g; s/\]\; _ам\. \[/A/g; s/\]\; _pl\. \[/A/g; s/\[[^]]*\]\ (полн.. форм.). \[[^]]*\] (редуцированн[^)]*)\ //g; s/\[[^]]*\]\ //g; s/\[[^]]*\],\ //; s/\ \[[^]]*\],/,/g; s/\ \[[^]]*\])/)/g; s/\ \[[^]]*\]:/:/g; s/\ \[[^]]*\];/;/g; s/\ \[[^]]*\]$//g; s/как\ "ju:"/как\ \[juЫ\]/g; s/"l"/\[l\]/g; s/"r"/\[r\]/g '
+}
+
+# Strip the copyright/info
+STRIP () {
+sed -n '/^_[aA]/,$p'
+}
+
+# Format the file
+MK_DATA () {
+sed 's/$/\
+/g; s/[^]]*\ \ /%h&\
+%d/; s/_[IVX][IVX]* /\
+ &/g; s/ [1-9]\. /\
+  &/g; s/[1-9][0-9]*>/\
+      &/g; s/[абвгдежзиклмнопрстуфчцчшхщъьэюя]>/(&>/g; s/>>/)/g; s/\ \_[AISE][a-z]*:/\
+  &/g; s/>/:/g'\
+|sed ' s/%d$/%z/; s/%d/%d\
+   / ; s/%z/%d/; s/%h/%h / '  \
+|fmt -s -w 74;}
+
+########################################################################
+
+if [ "$1" = "-version" ]; then 
+    INFO
+    exit 0
+fi
+
+if [ "$#" = 0 -o "$1" = "-h" -o "$1" = "--help" -o "$1" = "-help" ]; then 
+    USAGE
+    exit 0
+fi
+
+if [ "$#" != 3 ]; then 
+    USAGE; exit 1;
+fi
+
+## Will not go further if there are no dictfmt and dictzip binaries:
+if [ "$DICTFMT" = "" -o "$DICTZIP" = "" ]; then
+    REQUIREMENTS
+    exit 1
+fi
+##
+
+if [ ! -f "$2" ]; then
+    echo "No input file: $2"; USAGE; exit 1
+fi
+
+case $1 in
+    "--no-trans")
+       echo  "Removing transcription ($2 -> $3)..";
+       cat $2 | NO_TRANS > $3 || exit 1
+       echo "."; exit 0
+       ;;
+    "--src-data")
+       echo "Writing the header of $3.."
+       echo -e "%h 00-database-info\n%d" > $3
+       cat $2 | sed -n '1p' | sed 's/^/  /' | fmt -s -w 74 >> $3;
+       cat $2 | sed -n '/^_/,/_яп.  Japan японский/p' | sed 's/^/  /' | fmt -s -w 74 >> $3;
+       echo "" >> $3
+       echo "Formatting data ($2 -> $3).."
+       cat $2 | sed -n '/^_[aA]/,$p' | MK_DATA >> $3 || exit 1
+       echo "."; exit 0
+       ;;
+    "--data-dict")
+       TITLE="Mueller English-Russian Dictionary"
+       echo "dictfmt: $2 -> $3.dict and $3.index.."
+       dictfmt -p -u "http://www.chat.ru/~mueller_dic" \
+           -s "$TITLE" $3 < $2 || exit 1
+       echo "Compressing $3.dict.."; dictzip $3.dict || exit 1
+#      echo -n "Restarting daemons"; killall dictd; dictd
+       echo "."; exit 0
+       ;;
+    "--expand-index")
+# So that the line
+# ``whisky, whiskey   a sort of spirit I like''
+# could be found not only by /usr/bin/dict "whisky, whiskey", but also by 
+# /usr/bin/dict "whisky" and /usr/bin/dict "whiskey"
+       cat $2 | sed 's/^[^,]*, [^,]*/%TAG1&\
+%REM2&\
+%TAG3&/; s/^%TAG1[^,]*, /&%REM1/; s/, %REM1[^'$'\t'']*//; s/%REM2[^,]*, //; s/%TAG[13]//g' > $3 || exit 1
+       exit 0
+       ;;
+    "--dict-data")
+       if [ "` file $2 | grep  gzip`" != "0" ]; then
+           CAT=zcat;
+       else
+           CAT=cat;
+       fi
+       $CAT $2 | sed 's/^[^\ ].*/%h &\
+%d/; s/^[\ ][\ ]*/   /' >$3 || exit 1
+       echo "."; exit 0
+       ;;
+    *) INFO; USAGE; exit 1
+esac
+
+echo "You are not supposed to be here."
+exit 1
This page took 0.077409 seconds and 4 git commands to generate.