Skip to content

Commit 18c8c50

Browse files
committed
Update warnings
1 parent 296df1f commit 18c8c50

File tree

10 files changed

+21
-9
lines changed

10 files changed

+21
-9
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.7-slim-buster
1+
FROM python:3.8-slim-buster
22

33
COPY . .
44

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
| Version | Supported |
66
| ------- | ------------------ |
7+
| 3.1.x | :white_check_mark: |
78
| 3.0.x | :white_check_mark: |
89
| 2.3.x | :white_check_mark: |
910
| 2.2.x | :x: |

pythainlp/corpus/ttc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
Thai Textbook Corpus (TTC) word frequency
44
5-
Credit: Korakot Chaovavanich
5+
Credit: Korakot Chaovavanich
66
https://www.facebook.com/photo.php?fbid=363640477387469&set=gm.434330506948445&type=3&permPage=1
77
"""
88

pythainlp/parse/esupar_engine.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
GitHub: https://github.com/KoichiYasuoka/esupar
66
"""
77
from typing import List, Union
8-
import esupar
8+
try:
9+
import esupar
10+
except ImportError:
11+
raise ImportError("Import Error; Install esupar by pip install esupar")
912

1013

1114
class Parse:

pythainlp/tag/named_entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def load_engine(self, engine: str, corpus: str) -> None:
4545
elif engine == "wangchanberta":
4646
from pythainlp.wangchanberta import ThaiNameTagger
4747
if corpus=="lst20":
48-
print("""
48+
warnings.warn("""
4949
LST20 corpus are free for research and open source only.\n
5050
If you want to use in Commercial use, please contract NECTEC.\n
5151
https://www.facebook.com/dancearmy/posts/10157641945708284

pythainlp/tag/perceptron.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55
import os
66
from typing import List, Tuple
7+
import warnings
78

89
from pythainlp.corpus import corpus_path, get_corpus_path
910
from pythainlp.tag import PerceptronTagger, lst20, orchid
@@ -37,7 +38,7 @@ def _pud_tagger():
3738

3839
def _lst20_tagger():
3940
global _LST20_TAGGER
40-
print("""
41+
warnings.warn("""
4142
LST20 corpus are free for research and open source only.\n
4243
If you want to use in Commercial use, please contract NECTEC.\n
4344
https://www.facebook.com/dancearmy/posts/10157641945708284

pythainlp/tag/unigram.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import json
66
import os
77
from typing import List, Tuple
8+
import warnings
89

910
from pythainlp.corpus import corpus_path, get_corpus_path
1011
from pythainlp.tag import lst20, orchid
@@ -41,7 +42,7 @@ def _pud_tagger():
4142

4243
def _lst20_tagger():
4344
global _LST20_TAGGER
44-
print("""
45+
warnings.warn("""
4546
LST20 corpus are free for research and open source only.\n
4647
If you want to use in Commercial use, please contract NECTEC.\n
4748
https://www.facebook.com/dancearmy/posts/10157641945708284

pythainlp/tokenize/crfcls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Clause segmenter
44
"""
55
from typing import List
6+
import warnings
67

78
import pycrfsuite
89
from pythainlp.corpus import get_corpus_path
@@ -55,7 +56,7 @@ def _extract_features(doc):
5556

5657

5758
def segment(doc: List[str]) -> List[List[str]]:
58-
print("""
59+
warnings.warn("""
5960
LST20 corpus are free for research and open source only.\n
6061
If you want to use in Commercial use, please contract NECTEC.\n
6162
https://www.facebook.com/dancearmy/posts/10157641945708284

pythainlp/wangchanberta/postag.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from typing import Dict, List, Tuple, Union
33
import re
4+
import warnings
45
from transformers import (
56
CamembertTokenizer,
67
AutoTokenizer,
@@ -22,6 +23,12 @@ def __init__(
2223
grouped_word: bool = False
2324
) -> None:
2425
self.corpus = corpus
26+
if corpus=="lst20":
27+
warnings.warn("""
28+
LST20 corpus are free for research and open source only.\n
29+
If you want to use in Commercial use, please contract NECTEC.\n
30+
https://www.facebook.com/dancearmy/posts/10157641945708284
31+
""")
2532
self.grouped_word = grouped_word
2633
self.load()
2734

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292
"transformers>=4.22.1",
9393
],
9494
"dependency_parsing": [
95-
"esupar>=1.3.8",
9695
"spacy_thai>=0.7.1",
9796
"ufal.chu-liu-edmonds>=1.0.2",
9897
"transformers>=4.22.1",
@@ -126,7 +125,6 @@
126125
"thai_nner",
127126
"wunsen>=0.0.3",
128127
"spacy_thai>=0.7.1",
129-
"esupar>=1.3.8",
130128
"ufal.chu-liu-edmonds>=1.0.2",
131129
],
132130
}

0 commit comments

Comments
 (0)