File python-tltk.spec of Package python-tltk

#
# spec file for package python-tltk
#
# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

# affects the python macros even if not used in the spec file
%bcond_without libalternatives

%{?sle15_python_module_pythons}
%define pyname tltk
Name:           python-%{pyname}
Version:        1.10
Release:        0
Summary:        Thai Language Toolkit
License:        BSD-3-Clause
URL:            https://pypi.org/project/%{pyname}
Source:         https://files.pythonhosted.org/packages/source/t/%{pyname}/%{pyname}-%{version}.tar.gz
BuildRequires:  %{python_module base >= 3.10}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  alts
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildArch:      noarch
Requires:       alts
Requires:       %{python_module gensim}
Requires:       %{python_module nltk}
Requires:       %{python_module scikit-learn}
Requires:       %{python_module pandas}
Requires:       %{python_module sklearn-crfsuite}
%python_subpackages

%description
TLTK is a Python package designed for Thai language processing, which includes
functionalities such as syllable and word segmentation, discourse unit
segmentation, POS tagging, named entity recognition, grapheme-to-phoneme
conversion, IPA transcription, romanization, and more.

%prep
%autosetup -n %{pyname}-%{version}
chmod 644 tltk/*.dict
sed -i 's#/usr/bin/python$#%{_bindir}/python3#' tltk/*.py

%build
%pyproject_wheel

%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/tltk
%python_expand chmod 755 %{buildroot}%{$python_sitelib}/%{pyname}/corpus.py %{buildroot}%{$python_sitelib}/%{pyname}/nlp.py %{buildroot}%{$python_sitelib}/%{pyname}/th2ipa.py

%check

%files %{python_files}
%doc README.rst
%license LICENSE.txt LICENSE-gpl.txt
%{python_sitelib}/%{pyname}
%{python_sitelib}/%{pyname}-%{version}.dist-info
%python_alternative %{_bindir}/tltk

%changelog
openSUSE Build Service is sponsored by