Skip to content

Commit 34f0168

Browse files
committed
Fix morpheme backend info in README and docs
1 parent 7478bc4 commit 34f0168

File tree

11 files changed

+21
-21
lines changed

11 files changed

+21
-21
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Split texts into sentences.
6969
7070
Args:
7171
text (Union[str, List[str], Tuple[str]]): single text or list/tuple of texts
72-
backend (str): morpheme analyzer backend. 'mecab', 'pecab', 'punct' are supported
72+
backend (str): morpheme analyzer backend. 'mecab', 'pecab', 'punct', 'fast' are supported
7373
num_workers (Union[int, str]): the number of multiprocessing workers
7474
strip (bool): strip all sentences or not
7575
return_morphemes (bool): whether to return morphemes or not
@@ -1306,7 +1306,7 @@ This splits texts into sentences.
13061306

13071307
Args:
13081308
- text (`Union[str, List[str], Tuple[str]]`): single text or list/tuple of texts
1309-
- backend (`str`): morpheme analyzer backend. 'mecab', 'pecab', 'punct' are supported
1309+
- backend (`str`): morpheme analyzer backend. 'mecab', 'pecab', 'punct', 'fast' are supported
13101310
- num_workers (`Union[int, str]`): the number of multiprocessing workers
13111311
- strip (`bool`): strip all sentences or not
13121312
- return_morphemes (`bool`): whether to return morphemes or not
@@ -1332,7 +1332,7 @@ This corrects the spacing of the text.
13321332

13331333
Args:
13341334
- text (`Union[str, List[str], Tuple[str]]`): single text or list/tuple of texts
1335-
- backend (`str`): morpheme analyzer backend. 'mecab', 'pecab', 'punct' are supported
1335+
- backend (`str`): morpheme analyzer backend. 'mecab', 'pecab' are supported
13361336
- num_workers (`Union[int, str]`): the number of multiprocessing workers
13371337
- reset_whitespaces (`bool`): reset whitespaces or not
13381338
- return_morphemes (`bool`): whether to return morphemes or not
@@ -1359,7 +1359,7 @@ This summarizes the given text, using TextRank algorithm.
13591359

13601360
Args:
13611361
- text (`Union[str, List[str], Tuple[str]]`): single text or list/tuple of texts
1362-
- backend (`str`): morpheme analyzer backend. 'mecab', 'pecab' are supported.
1362+
- backend (`str`): morpheme analyzer backend. 'mecab', 'pecab', 'punct', 'fast' are supported.
13631363
- num_workers (`Union[int, str]`): the number of multiprocessing workers
13641364
- max_sentences (`int`): the max number of sentences in a summarization result.
13651365
- tolerance (`float`): a threshold for omitting edge weights.

kss/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,4 @@ def _find_closest_module(module, min_distance=0.5):
201201

202202

203203
__ALL__ = list(supported_modules.keys()) + ["Kss"]
204-
__version__ = "6.0.3"
204+
__version__ = "6.0.4"

kss/_modules/augmentation/augment.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from kss._modules.augmentation.utils import correct_josa
66
from kss._utils.logger import highlight_diffs, logger
77
from kss._utils.multiprocessing import _run_job
8-
from kss._utils.sanity_checks import _check_text, _check_type, _check_num_workers, _check_backend_mecab_pecab_only
8+
from kss._utils.sanity_checks import _check_text, _check_type, _check_num_workers, _check_analyzer_backend_mecab_pecab_only
99

1010

1111
def augment(
@@ -52,7 +52,7 @@ def augment(
5252
josa_correction = _check_type(josa_correction, "josa_correction", bool)
5353
verbose = _check_type(verbose, "verbose", bool)
5454
num_workers = _check_num_workers(text, num_workers)
55-
_check_backend_mecab_pecab_only(backend)
55+
_check_analyzer_backend_mecab_pecab_only(backend)
5656

5757
if num_workers is not False and verbose:
5858
verbose = False

kss/_modules/g2p/g2p.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)
3333
from kss._modules.jamo._jamo import h2j, j2h
3434
from kss._utils.multiprocessing import _run_job
35-
from kss._utils.sanity_checks import _check_text, _check_num_workers, _check_type, _check_backend_mecab_pecab_only
35+
from kss._utils.sanity_checks import _check_text, _check_num_workers, _check_type, _check_analyzer_backend_mecab_pecab_only
3636

3737

3838
def g2p(
@@ -89,7 +89,7 @@ def g2p(
8989
"convert_numbers_to_hangul_phonemes", bool)
9090
verbose = _check_type(verbose, "verbose", bool)
9191
num_workers = _check_num_workers(text, num_workers)
92-
_check_backend_mecab_pecab_only(backend)
92+
_check_analyzer_backend_mecab_pecab_only(backend)
9393

9494
return _run_job(
9595
func=partial(

kss/_modules/keywords/extract_keywords.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import List, Union, Tuple
44

55
from kss._modules.keywords.utils import KRWordRank
6-
from kss._utils.sanity_checks import _check_text, _check_type, _check_backend_mecab_pecab_only
6+
from kss._utils.sanity_checks import _check_text, _check_type, _check_analyzer_backend_mecab_pecab_only
77

88

99
def extract_keywords(
@@ -67,7 +67,7 @@ def extract_keywords(
6767
max_word_length = _check_type(max_word_length, "max_word_length", int)
6868
return_scores = _check_type(return_scores, "return_scores", bool)
6969
noun_only = _check_type(noun_only, "noun_only", bool)
70-
_check_backend_mecab_pecab_only(backend)
70+
_check_analyzer_backend_mecab_pecab_only(backend)
7171

7272
if num_workers != "auto":
7373
raise ValueError("`extract_keywords` does not support `num_workers` argument")

kss/_modules/morphemes/split_morphemes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from kss._utils.multiprocessing import _run_job
88
from kss._utils.sanity_checks import (
99
_check_text,
10-
_check_analyzer_backend,
10+
_check_analyzer_backend_mecab_pecab_only,
1111
_check_num_workers,
1212
_check_type,
1313
)
@@ -47,6 +47,6 @@ def split_morphemes(
4747
return text
4848

4949
num_workers = _check_num_workers(text, num_workers)
50-
backend = _check_analyzer_backend(backend)
50+
backend = _check_analyzer_backend_mecab_pecab_only(backend)
5151
result = _run_job(partial(backend.pos, drop_space=drop_space), text, num_workers)
5252
return result

kss/_modules/romanization/romanize.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from kss._modules.g2p.g2p import g2p
1111
from kss._modules.romanization.utils import pronounce, Syllable
1212
from kss._utils.multiprocessing import _run_job
13-
from kss._utils.sanity_checks import _check_text, _check_type, _check_num_workers, _check_backend_mecab_pecab_only
13+
from kss._utils.sanity_checks import _check_text, _check_type, _check_num_workers, _check_analyzer_backend_mecab_pecab_only
1414

1515
vowel = {
1616
# 단모음 monophthongs
@@ -124,7 +124,7 @@ def romanize(
124124
return text
125125

126126
use_morpheme_info = _check_type(use_morpheme_info, "use_morpheme_info", bool)
127-
_check_backend_mecab_pecab_only(backend)
127+
_check_analyzer_backend_mecab_pecab_only(backend)
128128
convert_english_to_hangul_phonemes = _check_type(convert_english_to_hangul_phonemes,
129129
"convert_english_to_hangul_phonemes", bool)
130130
convert_numbers_to_hangul_phonemes = _check_type(convert_numbers_to_hangul_phonemes,

kss/_modules/sentences/split_sentences.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def split_sentences(
3838
3939
Args:
4040
text (Union[str, List[str], Tuple[str]]): single text or list/tuple of texts
41-
backend (str): morpheme analyzer backend. 'mecab', 'pecab', 'punct' are supported
41+
backend (str): morpheme analyzer backend. 'mecab', 'pecab', 'punct', 'fast' are supported
4242
num_workers (Union[int, str])): the number of multiprocessing workers
4343
strip (bool): strip all sentences or not
4444
return_morphemes (bool): whether to return morphemes or not

kss/_modules/spacing/correct_spacing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from kss._modules.sentences.split_sentences import _split_sentences
1212
from kss._modules.spacing.utils import postprocess, postprocess_heuristic
1313
from kss._utils.multiprocessing import _run_job
14-
from kss._utils.sanity_checks import _check_text, _check_backend_mecab_pecab_only, _check_num_workers
14+
from kss._utils.sanity_checks import _check_text, _check_analyzer_backend_mecab_pecab_only, _check_num_workers
1515

1616
any_ws = re.compile(r"\s+")
1717
space_insertable = r"(([^SUWX]|X[RS]|S[EH]).* ([NMI]|V[VAX]|VCN|XR|XPN|S[WLHN]))|(SN ([MI]|N[PR]|NN[GP]|V[VAX]|VCN|XR|XPN|S[WHN]))|((S[FPL]).* ([NMI]|V[VAX]|VCN|XR|XPN|S[WHN]))"
@@ -42,7 +42,7 @@ def correct_spacing(
4242
4343
Args:
4444
text (Union[str, List[str], Tuple[str]]): single text or list/tuple of texts
45-
backend (str): morpheme analyzer backend. 'mecab', 'pecab', 'punct' are supported
45+
backend (str): morpheme analyzer backend. 'mecab', 'pecab' are supported
4646
num_workers (Union[int, str])): the number of multiprocessing workers
4747
reset_whitespaces (bool): reset whitespaces or not
4848
return_morphemes (bool): whether to return morphemes or not
@@ -67,7 +67,7 @@ def correct_spacing(
6767
return text
6868

6969
backend_string = backend
70-
backend = _check_backend_mecab_pecab_only(backend)
70+
backend = _check_analyzer_backend_mecab_pecab_only(backend)
7171
_num_workers = _check_num_workers(text, num_workers)
7272

7373
return _run_job(

kss/_modules/summarization/summarize_sentences.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def summarize_sentences(
3333
3434
Args:
3535
text (Union[str, List[str], Tuple[str]]): single text or list/tuple of texts
36-
backend (str): morpheme analyzer backend. 'mecab', 'pecab' are supported.
36+
backend (str): morpheme analyzer backend. 'mecab', 'pecab', 'punct', 'fast' are supported.
3737
num_workers (Union[int, str])): the number of multiprocessing workers
3838
max_sentences (int): the max number of sentences in a summarization result.
3939
tolerance (float): a threshold for omitting edge weights.

kss/_utils/sanity_checks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def _check_text(
198198
return text, finish
199199

200200

201-
def _check_backend_mecab_pecab_only(backend: str) -> Analyzer:
201+
def _check_analyzer_backend_mecab_pecab_only(backend: str) -> Analyzer:
202202
global MECAB_INFORM, KONLPY_MECAB_INFORM, PECAB_INFORM
203203

204204
if isinstance(backend, str):

0 commit comments

Comments
 (0)