Skip to content

Commit

Permalink
🎨 过滤空词语,略微降低性能 HIT-SCIR#589
Browse files Browse the repository at this point in the history
  • Loading branch information
AlongWY committed Sep 9, 2022
1 parent 45a7684 commit 7846ee1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/interface/ltp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "4.2.9"
__version__ = "4.2.10"

from ltp_extension.algorithms import StnSplit

Expand Down
3 changes: 2 additions & 1 deletion python/interface/ltp/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def version(self):
return __version__

def add_word(self, word: str, freq: int = 1):
self.hook.add_word(word, freq)
if len(word) > 0:
self.hook.add_word(word, freq)

def add_words(self, words: Union[str, List[str]], freq: int = 2):
if isinstance(words, str):
Expand Down
3 changes: 2 additions & 1 deletion python/interface/ltp/nerual.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def __init__(self, config=None, tokenizer=None):
self._check()

def add_word(self, word: str, freq: int = 1):
self.hook.add_word(word, freq)
if len(word) > 0:
self.hook.add_word(word, freq)

def add_words(self, words: Union[str, List[str]], freq: int = 2):
if isinstance(words, str):
Expand Down
2 changes: 1 addition & 1 deletion python/interface/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="ltp",
version="4.2.9",
version="4.2.10",
author="Yunlong Feng",
author_email="[email protected]",
url="https://github.com/HIT-SCIR/ltp",
Expand Down

0 comments on commit 7846ee1

Please sign in to comment.