diff --git a/README.md b/README.md index f5ad9c3..0153966 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Work in processing... ## Install -> pip install https://github.com/PyThaiNLP/spaCy-PyThaiNLP/archive/refs/heads/main.zip +> pip install spacy-pythainlp ## How to use diff --git a/setup.py b/setup.py index 74da862..95d4e8d 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name="spacy-pythainlp", - version="0.1dev2", + version="0.1dev3", description="PyThaiNLP For spaCy", long_description=readme, long_description_content_type="text/markdown", diff --git a/spacy_pythainlp/core.py b/spacy_pythainlp/core.py index 95ebfc1..2bd40fc 100644 --- a/spacy_pythainlp/core.py +++ b/spacy_pythainlp/core.py @@ -1,7 +1,5 @@ from pythainlp.tag import pos_tag -from pythainlp.tag import NER from pythainlp.tokenize import ( - sent_tokenize, word_tokenize, DEFAULT_SENT_TOKENIZE_ENGINE, DEFAULT_WORD_TOKENIZE_ENGINE @@ -63,6 +61,7 @@ def __init__( self.on_tokenize = tokenize self.pos_corpus = pos_corpus if self.on_ner: + from pythainlp.tag import NER self.ner = NER(engine=DEFAULT_NER) def __call__(self, doc:Doc): @@ -96,6 +95,7 @@ def _pos(self,doc:Doc): return doc def _sent(self, doc:Doc): + from pythainlp.tokenize import sent_tokenize _text = sent_tokenize(str(doc.text), engine=self.sent_engine) _doc = word_tokenize('SplitThword'.join(_text), engine=self.tokenize_engine) number_skip = 0