Skip to content

Commit 7c44b64

Browse files
committed
Add ImportError for phunspell and symspellpy
1 parent 016ea11 commit 7c44b64

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pythainlp/spell/phunspell.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"""
1414
from typing import List
1515

16-
import phunspell
16+
try:
17+
import phunspell
18+
except ImportError:
19+
raise ImportError("Import Error; Install phunspell by pip install phunspell")
1720

1821
pspell = phunspell.Phunspell("th_TH")
1922

pythainlp/spell/symspellpy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
from typing import List
1717

18-
from symspellpy import SymSpell, Verbosity
18+
try:
19+
import symspellpy
20+
except ImportError:
21+
raise ImportError("Import Error; Install symspellpy by pip install symspellpy")
1922

2023
from pythainlp.corpus import get_corpus_path, path_pythainlp_corpus
2124

0 commit comments

Comments
 (0)