[sisyphus] ispell dict. was:OO641-ALT2-rus

Aleksey Novodvorsky =?iso-8859-1?q?aen_=CE=C1_altlinux=2Eru?=
Вт Дек 18 14:23:52 MSK 2001


Hi!
Evgeny wrote:

> Hi!
>
> Сейчас на ftp лежит куча rpm для aspell:
> aspell-ru-lebedev-0.99e5-alt1.i586.rpm
> aspell-ru-lebedev-common-0.99e5-alt1.i586.rpm
> aspell-ru-lebedev-common-ie-0.99e5-alt1.i586.rpm
> aspell-ru-lebedev-common-io-0.99e5-alt1.i586.rpm
> aspell-ru-lebedev-ie-0.99e5-alt1.i586.rpm
> aspell-ru-lebedev-io-0.99e5-alt1.i586.rpm
>
> Они достаточно большие и хотелось бы разобраться с ними, прежде чем
> вытаскивать. То что это словари Лебедева версии 0.99e5 это понятно,
> а чьи правила? К сожалению, в самом малом по размеру нет никакой
> информации.
>

Я присоединяю spec, подробности -- у мейнтейнера.

>
> Сейчас Я сейчас пользуюсь правилами от моего коллеги Андрея Грозина,
> и сам конвертировал словарь версии 0.99e2 из ispell.

Правила в этой сборке старые, из словаря ASP, мы будем признательны,
если Вы укажете ссылку на лучшие.

>
>
> Еще видел в asp, но там правила были ну уж совсем куцыи.
>
> И ещё:
> > Сегодня ночью будет выложена наша сборка OO641.
> ...
> > -- Добавлен русский словарь для  ispell. По лицензионным соображениям
> > это словарь  Книжника, с Лебедевым будем разговаривать. Система
> > спеллинга в OOo несколько странная. Лучше бы ее переписать на корню, но
> > форкаться не хочется. Патч поддержки русского словаря очень кривой, над
> > ним предстоит еще большая работа.
> А какая здесь механика ispell, аspell или своя?

Увы, своя.
aspell/pspell мейнтейнеру лингвистической части OO не удалось собрать
под Win.

Rgrds, AEN

>
----------- следующая часть -----------
%define ispelldir %_libdir/ispell

# Pass "--without aspell" to disable building aspell dictionaries.
%define with_aspell   0%{!?_without_aspell:1}

# Pass "--without combined" to disable building combined ispell
# dictionary with 'ie' and 'io' spelling (which takes a lot of time
# and needs about 600M in $TMPDIR).
%define with_combined 0%{!?_without_combined:1}

Name: ispell-ru-lebedev
Version: 0.99e5
Release: alt1

Summary: Russian ispell dictionary -- KOI8-R, 'io' and 'ie' spelling allowed
License: distributable
Group: System/Internationalization

# ispell and aspell hash files are architecture-dependent
#but we need i586 instead i386
#BuildArch: %_build_arch

Source: ftp://mch5.chem.msu.su/pub/russian/ispell/rus-ispell-%version.tar.bz2
Source2: rus-ispell-aspellfiles.tar.bz2

Provides: ispell-dictionary
Requires: ispell
Obsoletes: irussian
Obsoletes: ispell-rus
Obsoletes: ispell-russian
Obsoletes: rispell
Obsoletes: ispell-ru
Provides: ispell-ru = %version

# Automatically added by buildreq on Sun Dec 02 2001,
# then manually edited to conditionalize aspell.
#BuildRequires: aspell ispell libaspell libltdl libpspell
BuildPreReq: ispell
%if %with_aspell
BuildPreReq: aspell libaspell libltdl libpspell
%endif

%package cp1251
Summary: Russian ispell dictionary -- CP1251, 'io' and 'ie' spelling allowed
Group: System/Internationalization

Provides: ispell-dictionary
Requires: ispell
Obsoletes: irussian
Obsoletes: ispell-rus
Obsoletes: ispell-russian
Obsoletes: rispell
Obsoletes: ispell-ru-cp1251
Provides: ispell-ru-cp1251 = %version

%package -n aspell-ru-lebedev
Summary: Russian dictionary for aspell -- 'io' and 'ie' spelling allowed
Group: System/Internationalization

Provides: aspell-dictionary
Requires: aspell
Obsoletes: aspell-ru
Provides: aspell-ru = %version
Provides: aspell-ru-lebedev-dictionary
Requires: aspell-ru-lebedev-common = %version-%release
Requires: aspell-ru-lebedev-common-ie = %version-%release
Requires: aspell-ru-lebedev-common-io = %version-%release


%package ie
Summary: Russian ispell dictionary -- KOI8-R, only 'ie' spelling allowed
Group: System/Internationalization
Provides: ispell-dictionary
Requires: ispell
Obsoletes: irussian
Obsoletes: ispell-rus
Obsoletes: ispell-russian
Obsoletes: rispell
Obsoletes: ispell-ru
Provides: ispell-ru = %version

%package ie-cp1251
Summary: Russian ispell dictionary -- CP1251, only 'ie' spelling allowed
Group: System/Internationalization
Provides: ispell-dictionary
Requires: ispell
Obsoletes: irussian
Obsoletes: ispell-rus
Obsoletes: ispell-russian
Obsoletes: rispell
Obsoletes: ispell-ru-cp1251
Provides: ispell-ru-cp1251 = %version

%package -n aspell-ru-lebedev-ie
Summary: Russian dictionary for aspell -- only 'ie' spelling allowed
Group: System/Internationalization
Provides: aspell-dictionary
Requires: aspell
Obsoletes: aspell-ru
Provides: aspell-ru = %version
Provides: aspell-ru-lebedev-dictionary
Requires: aspell-ru-lebedev-common = %version-%release
Requires: aspell-ru-lebedev-common-ie = %version-%release


%package io
Summary: Russian ispell dictionary -- KOI8-R, 'io' required
Group: System/Internationalization
Provides: ispell-dictionary
Requires: ispell
Obsoletes: irussian
Obsoletes: ispell-rus
Obsoletes: ispell-russian
Obsoletes: rispell
Obsoletes: ispell-ru
Provides: ispell-ru = %version

%package io-cp1251
Summary: Russian ispell dictionary -- CP1251, 'io' required
Group: System/Internationalization
Provides: ispell-dictionary
Requires: ispell
Obsoletes: irussian
Obsoletes: ispell-rus
Obsoletes: ispell-russian
Obsoletes: rispell
Obsoletes: ispell-ru-cp1251
Provides: ispell-ru-cp1251 = %version

%package -n aspell-ru-lebedev-io
Summary: Russian dictionary for aspell -- 'io' required
Group: System/Internationalization
Provides: aspell-dictionary
Requires: aspell
Obsoletes: aspell-ru
Provides: aspell-ru = %version
Provides: aspell-ru-lebedev-dictionary
Requires: aspell-ru-lebedev-common = %version-%release
Requires: aspell-ru-lebedev-common-io = %version-%release


%package -n aspell-ru-lebedev-common
Summary: Russian dictionary for aspell -- common files for all spellings
Group: System/Internationalization
Requires: aspell
Requires: aspell-ru-lebedev-dictionary

%package -n aspell-ru-lebedev-common-ie
Summary: Russian dictionary for aspell -- common files for 'ie' spellings
Group: System/Internationalization
Requires: aspell-ru-lebedev-common = %version-%release

%package -n aspell-ru-lebedev-common-io
Summary: Russian dictionary for aspell -- common files for 'io' spellings
Group: System/Internationalization
Requires: aspell-ru-lebedev-common = %version-%release


%description
Russian dictionary for ispell in KOI8-R encoding, created by
Alexander Lebedev.  This variant allows spellings with and without
the 'io' letter.

This dictionary is installed under the name "russian-lebedev".
Default Russian dictionary in KOI8-R encoding (with the name
"russian") is selected using update-alternatives (link name
"ispell-ru").

%description cp1251
Russian dictionary for ispell in CP1251 encoding, created by
Alexander Lebedev.  This variant allows spellings with and without
the 'io' letter.

This dictionary is installed under the name "russianw-lebedev".
Default Russian dictionary in CP1251 encoding (with the name
"russianw") is selected using update-alternatives (link name
"ispell-ru-cp1251").

%description -n aspell-ru-lebedev
Russian dictionary for use with aspell.  The word list for this
dictionary was created by Alexander Lebedev.  This variant allows
spellings with and without the 'io' letter.

This dictionary is installed under the name "ru--lebedev".
Default Russian dictionary for aspell (with the name "ru") is
selected using update-alternatives (link name "aspell-ru").


%description ie
Russian dictionary for ispell in KOI8-R encoding, created by
Alexander Lebedev.  This variant allows only spellings without
the 'io' letter.

This dictionary is installed under the name "russian-lebedev-ie".
Default Russian dictionary in KOI8-R encoding (with the name
"russian") is selected using update-alternatives (link name
"ispell-ru").

%description ie-cp1251
Russian dictionary for ispell in CP1251 encoding, created by
Alexander Lebedev.  This variant allows only spellings without
the 'io' letter.

This dictionary is installed under the name "russianw-lebedev-ie".
Default Russian dictionary in CP1251 encoding (with the name
"russianw") is selected using update-alternatives (link name
"ispell-ru-cp1251").

%description -n aspell-ru-lebedev-ie
Russian dictionary for use with aspell.  The word list for this
dictionary was created by Alexander Lebedev.  This variant allows
only spellings without the 'io' letter.

This dictionary is installed under the name "ru-ie-lebedev".
Default Russian dictionary for aspell (with the name "ru") is
selected using update-alternatives (link name "aspell-ru").


%description io
Russian dictionary for ispell in KOI8-R encoding, created by
Alexander Lebedev.  This variant requires strict use of the 'io'
letter.

This dictionary is installed under the name "russian-lebedev-io".
Default Russian dictionary in KOI8-R encoding (with the name
"russian") is selected using update-alternatives (link name
"ispell-ru").

%description io-cp1251
Russian dictionary for ispell in CP1251 encoding, created by
Alexander Lebedev.  This variant requires strict use of the 'io'
letter.


This dictionary is installed under the name "russianw-lebedev-io".
Default Russian dictionary in CP1251 encoding (with the name
"russianw") is selected using update-alternatives (link name
"ispell-ru-cp1251").

%description -n aspell-ru-lebedev-io
Russian dictionary for use with aspell.  The word list for this
dictionary was created by Alexander Lebedev.  This variant
requires strict use of the 'io' letter.

This dictionary is installed under the name "ru-io-lebedev".
Default Russian dictionary for aspell (with the name "ru") is
selected using update-alternatives (link name "aspell-ru").


%description -n aspell-ru-lebedev-common
Russian dictionary for use with aspell.  The word list for this
dictionary was created by Alexander Lebedev.

This package contains files which are common to all spelling
variants supported by this aspell dictionary.

%description -n aspell-ru-lebedev-common-ie
Russian dictionary for use with aspell.  The word list for this
dictionary was created by Alexander Lebedev.

This package contains files which are common to all spelling
variants which allow using 'ie' instead of 'io'.

%description -n aspell-ru-lebedev-common-io
Russian dictionary for use with aspell.  The word list for this
dictionary was created by Alexander Lebedev.

This package contains files which are common to all spelling
variants which allow using the 'io' letter.


%prep
%setup -c -a 2


%build

./trans koi win <README.koi >README.cp1251

# BuildIspellEncoding <spelling> <options> <encoding> <encoding-suffix>
function BuildIspellEncoding()
{
  make clean
  make "$3" $2
  if [ -n "$1" ] ; then
    suffix="-$1"
  else
    suffix=""
  fi
  cp -a russian.aff "russian$4-lebedev$suffix.aff"
  cp -a russian.hash "russian$4-lebedev$suffix.hash"
  # Note: do not put "make clean" here -- the intermediate files are needed
  # later to generate the expanded word list (for ispell or combined
  # dictionary).
}

# BuildWordList <spelling>
function BuildWordList()
{
  ispell -d ./russian.hash -e <russian.dict | \
    tr ' ' '\n' | sed -n -e '/^$/!p' | \
    sort -u >"$1.list"
}

# BuildAspellHash <part>
function BuildAspellHash()
{
  cp -af %_datadir/aspell/koi8-r.dat .
  LANG=ru_RU.KOI8-R aspell --lang=russian-lebedev --data-dir=. \
    create master ./russian-lebedev-"$1"_only <russian-lebedev-"$1"_only.list
}

# BuildSpelling <spelling> <options>
function BuildSpelling()
{
  BuildIspellEncoding "$1" "$2" "win" "w"
  BuildIspellEncoding "$1" "$2" "koi" ""
  # Note: "koi" must be last -- its files are used in BuildWordList
%if %with_aspell || %with_combined
  BuildWordList "$1"
%endif
  make clean
}

BuildSpelling "ie" ""
BuildSpelling "io" "YO=1"

# Now we have ie.list and io.list.
# We want to create a combined dictionary which will allow spellings
# either with 'io' or without it.

# For aspell we build three partial dictionaries and combine them with .multi
# files.
%if %with_aspell
  comm -12 ie.list io.list | ./sortkoi8 >russian-lebedev-common_only.list
  comm -13 ie.list io.list | ./sortkoi8 >russian-lebedev-io_only.list
  comm -23 ie.list io.list | ./sortkoi8 >russian-lebedev-ie_only.list
  BuildAspellHash common
  BuildAspellHash io
  BuildAspellHash ie
%endif

%if %with_combined

  # Prepare affix files for the combined ispell dictionary with 'ie' and 'io'.
  cp -a russian-lebedev-io.aff  russian-lebedev.aff
  cp -a russianw-lebedev-io.aff russianw-lebedev.aff

  # For ispell we need to build a combined word list and run munchlist on it.
  cat ie.list io.list | sort -u >combined.list
  munchlist -l ./russian-lebedev.aff -v combined.list >combined.dict

  # For some reason munchlist loses several one-letter words.  Find these lost
  # words and add them back.  (Also do some sanity checking of the generated
  # dictionary.)
  buildhash ./combined.dict ./russian-lebedev.aff ./combined.hash
  ispell -d ./combined.hash -e <combined.dict | \
    tr ' ' '\n' | sed -n -e '/^$/!p' | sort -u >combined.result
  comm -13 combined.list combined.result >combined.bad
  [ -s combined.bad ] && {
    echo "Error: munchlist generated dictionary which accepts bad words!" 1>&2
    exit 1
  }
  comm -23 combined.list combined.result >combined.missing
  cat combined.dict combined.missing | ./sortkoi8 | uniq >russian-lebedev.dict
  ./trans koi win <russian-lebedev.dict >russianw-lebedev.dict

  # Now build the combined dictionary hash for ispell
  buildhash ./russian-lebedev.dict  ./russian-lebedev.aff  \
            ./russian-lebedev.hash
  buildhash ./russianw-lebedev.dict ./russianw-lebedev.aff \
            ./russianw-lebedev.hash

%endif

%install
install -d $RPM_BUILD_ROOT%ispelldir
install -d $RPM_BUILD_ROOT%_libdir/aspell
install -d $RPM_BUILD_ROOT%_datadir/aspell
install -d $RPM_BUILD_ROOT%_datadir/pspell

# Install ispell hash and affix files
%if %with_combined
for spelling in "" "ie" "io"
%else
for spelling in "ie" "io"
%endif
do
  if [ -n "$spelling" ] ; then
    suffix="-$spelling"
  else
    suffix=""
  fi
  install -p -m 644 russian-lebedev"$suffix".aff   $RPM_BUILD_ROOT%ispelldir
  install -p -m 644 russian-lebedev"$suffix".hash  $RPM_BUILD_ROOT%ispelldir
  install -p -m 644 russianw-lebedev"$suffix".aff  $RPM_BUILD_ROOT%ispelldir
  install -p -m 644 russianw-lebedev"$suffix".hash $RPM_BUILD_ROOT%ispelldir
done

%if %with_aspell

  # Install aspell language data files
  install -p -m 644 russian-lebedev.dat $RPM_BUILD_ROOT%_datadir/aspell
  install -p -m 644 russian-lebedev_phonet.dat $RPM_BUILD_ROOT%_datadir/aspell

  # Install aspell hash files
  for i in common ie io ; do
    install -p -m 644 russian-lebedev-"$i"_only $RPM_BUILD_ROOT%_libdir/aspell
  done

  # Install aspell .multi files and pspell .pwli files
  for spelling in "" "ie" "io" ; do
    if [ -n "$spelling" ] ; then
      i="-$spelling"
    else
      i=""
    fi
    install -p -m 644 russian-lebedev"$i".multi $RPM_BUILD_ROOT%_libdir/aspell
    echo "%_libdir/aspell/russian-lebedev$i" \
      >$RPM_BUILD_ROOT%_datadir/pspell/ru-"$spelling"-lebedev-aspell.pwli
  done

%endif

# Some macros to simplify the install/uninstall scripts.
#
# Usage:
#  %%ispell_add <alt-name> <generic-dict-name> <real-dict-name> <priority>
#  %%ispell_fix <alt-name> <generic-dict-name>
#  %%ispell_del <alt-name> <real-dict-name>
%define ispell_add() /usr/sbin/update-alternatives --install %ispelldir/%2.hash %1 %ispelldir/%3.hash %4 --slave %ispelldir/%2.aff %1.aff %ispelldir/%3.aff
%define ispell_fix() [ -h %ispelldir/%2.hash ] || ln -s /etc/alternatives/%1 %ispelldir/%2.hash ||: ; [ -h %ispelldir/%2.aff ] || ln -s /etc/alternatives/%1.aff %ispelldir/%2.aff ||:
%define ispell_del() /usr/sbin/update-alternatives --remove %1 %ispelldir/%2.hash

# Like above, but for aspell:
#  %%ispell_add <alt-name> <generic-dict-name> <real-dict-name> <priority> \
#		<generic-multi-name> <real-multi-name>
#  %%ispell_fix <alt-name> <generic-dict-name>
#  %%ispell_del <alt-name> <real-dict-name>
%define aspell_add() /usr/sbin/update-alternatives --install %_datadir/pspell/%2-aspell.pwli %1 %_datadir/pspell/%3-aspell.pwli %4 --slave %_libdir/aspell/%5.multi %1.multi %_libdir/aspell/%6.multi
%define aspell_fix() [ -h %_datadir/pspell/%2-aspell.pwli ] || ln -s /etc/alternatives/%1 %_datadir/pspell/%2-aspell.pwli ||:
%define aspell_del() /usr/sbin/update-alternatives --remove %1 %_datadir/pspell/%2-aspell.pwli


%post
%ispell_add ispell-ru russian russian-lebedev 40

%triggerpostun -- ispell-ru
%ispell_fix ispell-ru russian

%preun
%ispell_del ispell-ru russian-lebedev


%post cp1251
%ispell_add ispell-ru-cp1251 russianw russianw-lebedev 40

%triggerpostun cp1251 -- ispell-ru-cp1251
%ispell_fix ispell-ru-cp1251 russianw

%preun cp1251
%ispell_del ispell-ru-cp1251 russianw-lebedev


%post -n aspell-ru-lebedev
%aspell_add aspell-ru ru ru--lebedev 40 russian russian-lebedev

%triggerpostun -n aspell-ru-lebedev -- aspell-ru
%aspell_fix aspell-ru ru

%preun -n aspell-ru-lebedev
%aspell_del aspell-ru ru--lebedev


%post ie
%ispell_add ispell-ru russian russian-lebedev-ie 30

%triggerpostun ie -- ispell-ru
%ispell_fix ispell-ru russian

%preun ie
%ispell_del ispell-ru russian-lebedev-ie


%post ie-cp1251
%ispell_add ispell-ru-cp1251 russianw russianw-lebedev-ie 30

%triggerpostun ie-cp1251 -- ispell-ru-cp1251
%ispell_fix ispell-ru-cp1251 russianw

%preun ie-cp1251
%ispell_del ispell-ru-cp1251 russianw-lebedev-ie


%post -n aspell-ru-lebedev-ie
%aspell_add aspell-ru ru ru-ie-lebedev 30 russian russian-lebedev-ie

%triggerpostun -n aspell-ru-lebedev-ie -- aspell-ru
%aspell_fix aspell-ru ru

%preun -n aspell-ru-lebedev-ie
%aspell_del aspell-ru ru-ie-lebedev


%post io
%ispell_add ispell-ru russian russian-lebedev-io 20

%triggerpostun io -- ispell-ru
%ispell_fix ispell-ru russian

%preun io
%ispell_del ispell-ru russian-lebedev-io


%post io-cp1251
%ispell_add ispell-ru-cp1251 russianw russianw-lebedev-io 20

%triggerpostun io-cp1251 -- ispell-ru-cp1251
%ispell_fix ispell-ru-cp1251 russianw

%preun io-cp1251
%ispell_del ispell-ru-cp1251 russianw-lebedev-io


%post -n aspell-ru-lebedev-io
%aspell_add aspell-ru ru ru-io-lebedev 20 russian russian-lebedev-io

%triggerpostun -n aspell-ru-lebedev-io -- aspell-ru
%aspell_fix aspell-ru ru

%preun -n aspell-ru-lebedev-io
%aspell_del aspell-ru ru-io-lebedev


%if %with_combined

%files
%doc LICENSE README README.koi
%ispelldir/russian-lebedev.*

%files cp1251
%doc LICENSE README README.cp1251
%ispelldir/russianw-lebedev.*

%endif

%if %with_aspell
%files -n aspell-ru-lebedev
%doc LICENSE README README.koi
%_libdir/aspell/russian-lebedev.multi
%_datadir/pspell/ru--lebedev*
%endif

%files ie
%doc LICENSE README README.koi
%ispelldir/russian-lebedev-ie.*

%files ie-cp1251
%doc LICENSE README README.cp1251
%ispelldir/russianw-lebedev-ie.*

%if %with_aspell
%files -n aspell-ru-lebedev-ie
%doc LICENSE README README.koi
%_libdir/aspell/russian-lebedev-ie.multi
%_datadir/pspell/ru-ie-lebedev*
%endif


%files io
%doc LICENSE README README.koi
%ispelldir/russian-lebedev-io.*

%files io-cp1251
%doc LICENSE README README.cp1251
%ispelldir/russianw-lebedev-io.*

%if %with_aspell
%files -n aspell-ru-lebedev-io
%doc LICENSE README README.koi
%_libdir/aspell/russian-lebedev-io.multi
%_datadir/pspell/ru-io-lebedev*
%endif


%if %with_aspell

%files -n aspell-ru-lebedev-common
%_libdir/aspell/russian-lebedev-common_only
%_datadir/aspell/russian-lebedev*

%files -n aspell-ru-lebedev-common-ie
%_libdir/aspell/russian-lebedev-ie_only

%files -n aspell-ru-lebedev-common-io
%_libdir/aspell/russian-lebedev-io_only

%endif

%changelog
* Sun Dec 02 2001 Sergey Vlasov <vsu на altlinux.ru> 0.99e5-alt1
- First spec



Подробная информация о списке рассылки Sisyphus