Skip to content

Commit

Permalink
Merge pull request #789 from PyThaiNLP/4.0
Browse files Browse the repository at this point in the history
PyThaiNLP 4.0 Released!
  • Loading branch information
wannaphong authored Apr 14, 2023
2 parents 1dd81c8 + 494f5ae commit 462a83e
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
conda install -c conda-forge icu
conda install -c conda-forge pyicu
if [ -f docker_requirements.txt ]; then pip install -r docker_requirements.txt; fi
pip install deepcut
pip install deepcut tltk
pip install .[full]
python -m nltk.downloader omw-1.4
if: matrix.os != 'self-hosted'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install deepcut
pip install deepcut tltk
pip install -r https://raw.githubusercontent.com/PyThaiNLP/pythainlp/dev/docker_requirements.txt
pip install pythainlp[full]
python -m nltk.downloader omw-1.4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
python -m pip install --upgrade pip
pip install pytest coverage coveralls
if [ -f docker_requirements.txt ]; then pip install -r docker_requirements.txt; fi
pip install deepcut
pip install deepcut tltk
pip install .[full]
python -m nltk.downloader omw-1.4
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
python -m pip install -r docker_requirements.txt
python -m pip install .[full]
python -m nltk.downloader omw-1.4
python -m pip install spacy deepcut
python -m pip install spacy deepcut tltk
- name: Test
shell: powershell
env:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ PyThaiNLP เป็นไลบารีภาษาไพทอนสำหร
| Version | Description | Status |
|:------:|:--:|:------:|
| [3.1](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/643) |
| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | Release Candidate for 4.0 | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/714) |
| [4.0](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/714) |
| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | Release Candidate for 4.1 | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/788) |


## Getting Started
Expand Down
4 changes: 2 additions & 2 deletions README_TH.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ PyThaiNLP เป็นไลบารีภาษาไพทอนสำหร
| รุ่น | คำอธิบาย | สถานะ |
|:------:|:--:|:------:|
| [3.1](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/643) |
| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | Release Candidate for 4.0 | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/714) |
| [4.0](https://github.com/PyThaiNLP/pythainlp/releases) | Stable | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/714) |
| [`dev`](https://github.com/PyThaiNLP/pythainlp/tree/dev) | Release Candidate for 4.1 | [Change Log](https://github.com/PyThaiNLP/pythainlp/issues/788) |

ติดตามพวกเราบน [PyThaiNLP Facebook page](https://www.facebook.com/pythainlp/) เพื่อรับข่าวสารเพิ่มเติม

Expand Down
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

| Version | Supported |
| ------- | ------------------ |
| 4.0.x | :white_check_mark: |
| 3.1.x | :white_check_mark: |
| 3.0.x | :x: |
| 2.3.x | :x: |
Expand Down
1 change: 0 additions & 1 deletion docs/notes/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ where ``extras`` can be
- ``wordnet`` (to support wordnet)
- ``spell`` (to support phunspell & symspellpy)
- ``generate`` (to support text generate with umlfit or thai2fit)
- ``tltk`` (to support tltk)
- ``textaugment`` (to support text augmentation)
- ``oskut`` (to support OSKUT)
- ``nlpo3`` (to support nlpo3 engine)
Expand Down
1 change: 1 addition & 0 deletions pythainlp/khavee/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.
from typing import List, Union
from pythainlp.tokenize import subword_tokenize
from pythainlp.util import sound_syllable


class KhaveeVerifier:
Expand Down
5 changes: 4 additions & 1 deletion pythainlp/spell/tltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
* \
https://pypi.org/project/tltk/
"""
from tltk.nlp import spell_candidates
try:
from tltk.nlp import spell_candidates
except ImportError:
raise ImportError("Not found tltk! Please install tltk by pip install tltk")
from typing import List


Expand Down
5 changes: 4 additions & 1 deletion pythainlp/tag/tltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import List, Tuple, Union
from tltk import nlp
try:
from tltk import nlp
except ImportError:
raise ImportError("Not found tltk! Please install tltk by pip install tltk")
from pythainlp.tokenize import word_tokenize

nlp.pos_load()
Expand Down
5 changes: 4 additions & 1 deletion pythainlp/tokenize/deepcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@

from typing import List, Union

from deepcut import tokenize
try:
from deepcut import tokenize
except ImportError:
raise ImportError("Please install deepcut by pip install deepcut")
from pythainlp.util import Trie


Expand Down
7 changes: 5 additions & 2 deletions pythainlp/tokenize/tltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import List
from tltk.nlp import word_segment as tltk_segment
from tltk.nlp import syl_segment
try:
from tltk.nlp import word_segment as tltk_segment
from tltk.nlp import syl_segment
except ImportError:
raise ImportError("Not found tltk! Please install tltk by pip install tltk")


def segment(text: str) -> List[str]:
Expand Down
5 changes: 4 additions & 1 deletion pythainlp/transliterate/tltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tltk.nlp import g2p, th2ipa, th2roman
try:
from tltk.nlp import g2p, th2ipa, th2roman
except ImportError:
raise ImportError("Not found tltk! Please install tltk by pip install tltk")


def romanize(text: str) -> str:
Expand Down
21 changes: 16 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-2023 PyThaiNLP Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Setup script for PyThaiNLP.
Expand Down Expand Up @@ -73,7 +86,6 @@
"spylls>=0.1.5",
"symspellpy>=6.7.6"
],
"tltk": ["tltk>=1.3.8"],
"oskut": ["oskut>=1.3"],
"nlpo3": ["nlpo3>=1.2.2"],
"onnx": [
Expand Down Expand Up @@ -119,7 +131,6 @@
"phunspell>=0.1.6",
"spylls>=0.1.5",
"symspellpy>=6.7.6",
"tltk>=1.3.8",
"oskut>=1.3",
"nlpo3>=1.2.2",
"onnxruntime>=1.10.0",
Expand All @@ -132,7 +143,7 @@

setup(
name="pythainlp",
version="4.0.0beta1",
version="4.0.0",
description="Thai Natural Language Processing library",
long_description=readme,
long_description_content_type="text/markdown",
Expand Down Expand Up @@ -165,7 +176,7 @@
"Thai language",
],
classifiers=[
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
Expand All @@ -181,7 +192,7 @@
],
},
project_urls={
"Documentation": "https://pythainlp.github.io/docs/3.0/",
"Documentation": "https://pythainlp.github.io/docs/4.0/",
"Tutorials": "https://pythainlp.github.io/tutorials/",
"Source Code": "https://github.com/PyThaiNLP/pythainlp",
"Bug Tracker": "https://github.com/PyThaiNLP/pythainlp/issues",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_khavee.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def test_check_sara(self):
def test_check_marttra(self):
self.assertEqual(kv.check_marttra('สาว'), 'เกอว')

def test_check_sumpus(self):
self.assertTrue(kv.check_sumpus('สรร','อัน'))
self.assertFalse(kv.check_sumpus('สรร','แมว'))
def test_is_sumpus(self):
self.assertTrue(kv.is_sumpus('สรร','อัน'))
self.assertFalse(kv.is_sumpus('สรร','แมว'))

def test_check_klon(self):
self.assertEqual(
Expand Down

0 comments on commit 462a83e

Please sign in to comment.