Skip to content

Commit

Permalink
Drop tltk from requirements
Browse files Browse the repository at this point in the history
From #774, I was drop tltk from requirements.
  • Loading branch information
wannaphong committed Apr 14, 2023
1 parent 7a160de commit 494f5ae
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 12 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
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
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
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
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,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 @@ -132,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 Down

0 comments on commit 494f5ae

Please sign in to comment.