Skip to content

Commit 494f5ae

Browse files
committed
Drop tltk from requirements
From #774, I was drop tltk from requirements.
1 parent 7a160de commit 494f5ae

File tree

10 files changed

+21
-12
lines changed

10 files changed

+21
-12
lines changed

.github/workflows/macos-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
conda install -c conda-forge icu
7575
conda install -c conda-forge pyicu
7676
if [ -f docker_requirements.txt ]; then pip install -r docker_requirements.txt; fi
77-
pip install deepcut
77+
pip install deepcut tltk
7878
pip install .[full]
7979
python -m nltk.downloader omw-1.4
8080
if: matrix.os != 'self-hosted'

.github/workflows/pypi-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install deepcut
24+
pip install deepcut tltk
2525
pip install -r https://raw.githubusercontent.com/PyThaiNLP/pythainlp/dev/docker_requirements.txt
2626
pip install pythainlp[full]
2727
python -m nltk.downloader omw-1.4

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
python -m pip install --upgrade pip
3232
pip install pytest coverage coveralls
3333
if [ -f docker_requirements.txt ]; then pip install -r docker_requirements.txt; fi
34-
pip install deepcut
34+
pip install deepcut tltk
3535
pip install .[full]
3636
python -m nltk.downloader omw-1.4
3737
- name: Test

.github/workflows/windows-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
python -m pip install -r docker_requirements.txt
5252
python -m pip install .[full]
5353
python -m nltk.downloader omw-1.4
54-
python -m pip install spacy deepcut
54+
python -m pip install spacy deepcut tltk
5555
- name: Test
5656
shell: powershell
5757
env:

docs/notes/installation.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ where ``extras`` can be
2828
- ``wordnet`` (to support wordnet)
2929
- ``spell`` (to support phunspell & symspellpy)
3030
- ``generate`` (to support text generate with umlfit or thai2fit)
31-
- ``tltk`` (to support tltk)
3231
- ``textaugment`` (to support text augmentation)
3332
- ``oskut`` (to support OSKUT)
3433
- ``nlpo3`` (to support nlpo3 engine)

pythainlp/spell/tltk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
* \
2222
https://pypi.org/project/tltk/
2323
"""
24-
from tltk.nlp import spell_candidates
24+
try:
25+
from tltk.nlp import spell_candidates
26+
except ImportError:
27+
raise ImportError("Not found tltk! Please install tltk by pip install tltk")
2528
from typing import List
2629

2730

pythainlp/tag/tltk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
from typing import List, Tuple, Union
16-
from tltk import nlp
16+
try:
17+
from tltk import nlp
18+
except ImportError:
19+
raise ImportError("Not found tltk! Please install tltk by pip install tltk")
1720
from pythainlp.tokenize import word_tokenize
1821

1922
nlp.pos_load()

pythainlp/tokenize/tltk.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
from typing import List
16-
from tltk.nlp import word_segment as tltk_segment
17-
from tltk.nlp import syl_segment
16+
try:
17+
from tltk.nlp import word_segment as tltk_segment
18+
from tltk.nlp import syl_segment
19+
except ImportError:
20+
raise ImportError("Not found tltk! Please install tltk by pip install tltk")
1821

1922

2023
def segment(text: str) -> List[str]:

pythainlp/transliterate/tltk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
from tltk.nlp import g2p, th2ipa, th2roman
15+
try:
16+
from tltk.nlp import g2p, th2ipa, th2roman
17+
except ImportError:
18+
raise ImportError("Not found tltk! Please install tltk by pip install tltk")
1619

1720

1821
def romanize(text: str) -> str:

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
"spylls>=0.1.5",
8787
"symspellpy>=6.7.6"
8888
],
89-
"tltk": ["tltk>=1.3.8"],
9089
"oskut": ["oskut>=1.3"],
9190
"nlpo3": ["nlpo3>=1.2.2"],
9291
"onnx": [
@@ -132,7 +131,6 @@
132131
"phunspell>=0.1.6",
133132
"spylls>=0.1.5",
134133
"symspellpy>=6.7.6",
135-
"tltk>=1.3.8",
136134
"oskut>=1.3",
137135
"nlpo3>=1.2.2",
138136
"onnxruntime>=1.10.0",

0 commit comments

Comments
 (0)