Skip to content

Commit 7326ddd

Browse files
authored
Merge pull request #156 from mammothb/build/fix-dependency
Build/fix dependency
2 parents 8b45841 + d4645ec commit 7326ddd

20 files changed

+1785
-1772
lines changed

.git-blame-ignore-revs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# format all
2+
b0abc5ed3a37b05848ca1e2de790321d7c07fd75

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.py eol=lf

pyproject.toml

+14-13
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
requires = ["setuptools>=58.0.4", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.isort]
6-
profile = "black"
5+
[tool.basedpyright]
6+
pythonVersion = "3.8"
77

8-
[tool.pylint]
9-
[tool.pylint.'MESSAGES CONTROL']
10-
disable = [
11-
"logging-fstring-interpolation",
12-
"too-many-arguments",
13-
"too-many-branches",
14-
"too-many-instance-attributes",
15-
"too-many-locals",
16-
"too-many-nested-blocks",
17-
"too-many-statements",
18-
]
8+
reportUnusedCallResult = "none"
9+
10+
[tool.ruff]
11+
line-length = 88
12+
indent-width = 4
13+
14+
[tool.ruff.format]
15+
docstring-code-format = false
16+
indent-style = "space"
17+
line-ending = "auto"
18+
quote-style = "double"
19+
skip-magic-trailing-comma = false

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ editdistpy>=0.1.3
33
# For testing
44
coverage==7.4.4
55
importlib-resources>=6.3.2
6-
numpy>=1.19.5
76
pytest==8.1.1
87
pytest-cov==4.1.0

symspellpy/__init__.py

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
# MIT License
2-
#
3-
# Copyright (c) 2022 mmb L (Python port)
4-
# Copyright (c) 2021 Wolf Garbe (Original C# implementation)
5-
#
6-
# Permission is hereby granted, free of charge, to any person obtaining a copy
7-
# of this software and associated documentation files (the "Software"), to deal
8-
# in the Software without restriction, including without limitation the rights
9-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
# copies of the Software, and to permit persons to whom the Software is
11-
# furnished to do so, subject to the following conditions:
12-
#
13-
# The above copyright notice and this permission notice shall be included in all
14-
# copies or substantial portions of the Software.
15-
16-
"""symspellpy
17-
18-
.. moduleauthor:: mmb L <[email protected]>
19-
.. moduleauthor:: Wolf Garbe <[email protected]>
20-
"""
21-
22-
__version__ = "6.7.7"
23-
24-
from . import editdistance, helpers, logging
25-
from .symspellpy import SymSpell
26-
from .verbosity import Verbosity
1+
# MIT License
2+
#
3+
# Copyright (c) 2022 mmb L (Python port)
4+
# Copyright (c) 2021 Wolf Garbe (Original C# implementation)
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
16+
"""symspellpy
17+
18+
.. moduleauthor:: mmb L <[email protected]>
19+
.. moduleauthor:: Wolf Garbe <[email protected]>
20+
"""
21+
22+
__version__ = "6.7.7"
23+
24+
from . import editdistance, helpers, logging
25+
from .symspellpy import SymSpell
26+
from .verbosity import Verbosity

symspellpy/composition.py

+57-57
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
# MIT License
2-
#
3-
# Copyright (c) 2022 mmb L (Python port)
4-
# Copyright (c) 2021 Wolf Garbe (Original C# implementation)
5-
#
6-
# Permission is hereby granted, free of charge, to any person obtaining a copy
7-
# of this software and associated documentation files (the "Software"), to deal
8-
# in the Software without restriction, including without limitation the rights
9-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
# copies of the Software, and to permit persons to whom the Software is
11-
# furnished to do so, subject to the following conditions:
12-
#
13-
# The above copyright notice and this permission notice shall be included in all
14-
# copies or substantial portions of the Software.
15-
16-
"""
17-
.. module:: compostiion
18-
:synopsis: Data class for :meth:`symspellpy.symspellpy.word_segmentation`.
19-
"""
20-
21-
from typing import NamedTuple
22-
23-
24-
class Composition(NamedTuple):
25-
"""Used by :meth:`word_segmentation`.
26-
27-
Attributes:
28-
segmented_string: The word segmented string.
29-
corrected_string: The spelling corrected string.
30-
distance_sum: The sum of edit distance between input string and
31-
corrected string
32-
log_prob_sum: The sum of word occurrence probabilities in log
33-
scale (a measure of how common and probable the corrected
34-
segmentation is).
35-
"""
36-
37-
segmented_string: str = ""
38-
corrected_string: str = ""
39-
distance_sum: int = 0
40-
log_prob_sum: float = 0
41-
42-
@classmethod
43-
def create(
44-
cls,
45-
composition: "Composition",
46-
segmented_part: str,
47-
corrected_part: str,
48-
distance: int,
49-
log_prob: float,
50-
) -> "Composition":
51-
"""Creates a Composition by appending to an existing Composition."""
52-
return cls(
53-
composition.segmented_string + segmented_part,
54-
composition.corrected_string + corrected_part,
55-
composition.distance_sum + distance,
56-
composition.log_prob_sum + log_prob,
57-
)
1+
# MIT License
2+
#
3+
# Copyright (c) 2022 mmb L (Python port)
4+
# Copyright (c) 2021 Wolf Garbe (Original C# implementation)
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
16+
"""
17+
.. module:: compostiion
18+
:synopsis: Data class for :meth:`symspellpy.symspellpy.word_segmentation`.
19+
"""
20+
21+
from typing import NamedTuple
22+
23+
24+
class Composition(NamedTuple):
25+
"""Used by :meth:`word_segmentation`.
26+
27+
Attributes:
28+
segmented_string: The word segmented string.
29+
corrected_string: The spelling corrected string.
30+
distance_sum: The sum of edit distance between input string and
31+
corrected string
32+
log_prob_sum: The sum of word occurrence probabilities in log
33+
scale (a measure of how common and probable the corrected
34+
segmentation is).
35+
"""
36+
37+
segmented_string: str = ""
38+
corrected_string: str = ""
39+
distance_sum: int = 0
40+
log_prob_sum: float = 0
41+
42+
@classmethod
43+
def create(
44+
cls,
45+
composition: "Composition",
46+
segmented_part: str,
47+
corrected_part: str,
48+
distance: int,
49+
log_prob: float,
50+
) -> "Composition":
51+
"""Creates a Composition by appending to an existing Composition."""
52+
return cls(
53+
composition.segmented_string + segmented_part,
54+
composition.corrected_string + corrected_part,
55+
composition.distance_sum + distance,
56+
composition.log_prob_sum + log_prob,
57+
)

0 commit comments

Comments
 (0)