Skip to content

Commit a4cc77b

Browse files
authored
Merge pull request #160 from mammothb/dev
build: prepare 6.7.8 release
2 parents 7326ddd + 9e08dc3 commit a4cc77b

24 files changed

+314
-232
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 mmb L (Python port https://github.com/mammothb/symspellpy)
3+
Copyright (c) 2024 mmb L (Python port https://github.com/mammothb/symspellpy)
44
Copyright (c) 2021 Wolf Garbe (Original C# implementation https://github.com/wolfgarbe/SymSpell)
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ symspellpy <br>
55
[![codecov](https://codecov.io/gh/mammothb/symspellpy/branch/master/graph/badge.svg)](https://codecov.io/gh/mammothb/symspellpy)
66
========
77

8-
symspellpy is a Python port of [SymSpell](https://github.com/wolfgarbe/SymSpell) v6.7.1, which provides much higher speed and lower memory consumption. Unit tests
8+
symspellpy is a Python port of [SymSpell](https://github.com/wolfgarbe/SymSpell) v6.7.2, which provides much higher speed and lower memory consumption. Unit tests
99
from the original project are implemented to ensure the accuracy of the port.
1010

1111
Please note that the port has not been optimized for speed.
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**************************
2+
abstract_distance_comparer
3+
**************************
4+
5+
Distance comparer interface
6+
===========================
7+
8+
.. autoclass:: symspellpy.abstract_distance_comparer.AbstractDistanceComparer
9+
:members:

docs/api/editdistance.rst

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ EditDistance class
1717
Distance comparer classes
1818
=========================
1919

20-
.. autoclass:: symspellpy.editdistance.AbstractDistanceComparer
21-
:members:
22-
2320
.. autoclass:: symspellpy.editdistance.DamerauOsa
2421
:members:
2522

docs/api/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ Modules
1111
:maxdepth: 2
1212

1313
helpers.rst
14+
abstract_distance_comparer.rst
1415
editdistance.rst
1516
symspellpy.rst

docs/conf.py

+114-113
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,114 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# Configuration file for the Sphinx documentation builder.
4-
#
5-
# This file does only contain a selection of the most common options. For a
6-
# full list see the documentation:
7-
# http://www.sphinx-doc.org/en/master/config
8-
9-
# -- Path setup --------------------------------------------------------------
10-
11-
# If extensions (or modules to document with autodoc) are in another directory,
12-
# add these directories to sys.path here. If the directory is relative to the
13-
# documentation root, use os.path.abspath to make it absolute, like shown here.
14-
15-
import os.path
16-
import sys
17-
18-
sys.path.insert(0, os.path.abspath(".."))
19-
20-
import symspellpy
21-
22-
# -- Project information -----------------------------------------------------
23-
24-
project = "symspellpy"
25-
copyright = "2021, mmb L, Wolf Garbe"
26-
author = "mmb L, Wolf Garbe"
27-
28-
# The short X.Y version
29-
version = ""
30-
# The full version, including alpha/beta/rc tags
31-
release = symspellpy.__version__
32-
33-
34-
# -- General configuration ---------------------------------------------------
35-
36-
# If your documentation needs a minimal Sphinx version, state it here.
37-
#
38-
# needs_sphinx = '1.0'
39-
40-
# Add any Sphinx extension module names here, as strings. They can be
41-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
42-
# ones.
43-
extensions = [
44-
"sphinx.ext.autodoc",
45-
"sphinx.ext.napoleon",
46-
"sphinx.ext.viewcode",
47-
"sphinx_autodoc_typehints",
48-
]
49-
# numpydoc_class_members_toctree = False
50-
# numpydoc_show_inherited_class_members = False
51-
highlight_language = "none"
52-
53-
# Add any paths that contain templates here, relative to this directory.
54-
templates_path = ["_templates"]
55-
56-
# The suffix(es) of source filenames.
57-
# You can specify multiple suffix as a list of string:
58-
#
59-
# source_suffix = ['.rst', '.md']
60-
source_suffix = ".rst"
61-
62-
# The master toctree document.
63-
master_doc = "index"
64-
65-
# The language for content autogenerated by Sphinx. Refer to documentation
66-
# for a list of supported languages.
67-
#
68-
# This is also used if you do content translation via gettext catalogs.
69-
# Usually you set "language" from the command line for these cases.
70-
language = None
71-
72-
# List of patterns, relative to source directory, that match files and
73-
# directories to ignore when looking for source files.
74-
# This pattern also affects html_static_path and html_extra_path.
75-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
76-
77-
# The name of the Pygments (syntax highlighting) style to use.
78-
pygments_style = None
79-
80-
81-
# -- Options for HTML output -------------------------------------------------
82-
83-
# The theme to use for HTML and HTML Help pages. See the documentation for
84-
# a list of builtin themes.
85-
#
86-
html_theme = "sphinxdoc"
87-
88-
# Theme options are theme-specific and customize the look and feel of a theme
89-
# further. For a list of options available for each theme, see the
90-
# documentation.
91-
#
92-
# html_theme_options = {}
93-
94-
# Add any paths that contain custom static files (such as style sheets) here,
95-
# relative to this directory. They are copied after the builtin static files,
96-
# so a file named "default.css" will overwrite the builtin "default.css".
97-
html_static_path = ["_static"]
98-
99-
# Custom sidebar templates, must be a dictionary that maps document names
100-
# to template names.
101-
#
102-
# The default sidebars (for documents that don't match any pattern) are
103-
# defined by theme itself. Builtin themes are using these templates by
104-
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
105-
# 'searchbox.html']``.
106-
#
107-
html_sidebars = {"**": ["globaltoc.html", "searchbox.html"]}
108-
109-
110-
# -- Options for HTMLHelp output ---------------------------------------------
111-
112-
# Output file base name for HTML help builder.
113-
htmlhelp_basename = "symspellpydoc"
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
15+
import os.path
16+
import sys
17+
18+
sys.path.insert(0, os.path.abspath(".."))
19+
20+
import symspellpy
21+
22+
# -- Project information -----------------------------------------------------
23+
24+
project = "symspellpy"
25+
copyright = "2021, mmb L, Wolf Garbe"
26+
author = "mmb L, Wolf Garbe"
27+
28+
# The short X.Y version
29+
version = ""
30+
# The full version, including alpha/beta/rc tags
31+
release = symspellpy.__version__
32+
33+
34+
# -- General configuration ---------------------------------------------------
35+
36+
# If your documentation needs a minimal Sphinx version, state it here.
37+
#
38+
# needs_sphinx = '1.0'
39+
40+
# Add any Sphinx extension module names here, as strings. They can be
41+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
42+
# ones.
43+
extensions = [
44+
"sphinx.ext.autodoc",
45+
"sphinx.ext.napoleon",
46+
"sphinx.ext.viewcode",
47+
"sphinx_autodoc_typehints",
48+
]
49+
# numpydoc_class_members_toctree = False
50+
# numpydoc_show_inherited_class_members = False
51+
highlight_language = "none"
52+
53+
# Add any paths that contain templates here, relative to this directory.
54+
templates_path = ["_templates"]
55+
56+
# The suffix(es) of source filenames.
57+
# You can specify multiple suffix as a list of string:
58+
#
59+
# source_suffix = ['.rst', '.md']
60+
source_suffix = ".rst"
61+
62+
# The master toctree document.
63+
master_doc = "index"
64+
65+
# The language for content autogenerated by Sphinx. Refer to documentation
66+
# for a list of supported languages.
67+
#
68+
# This is also used if you do content translation via gettext catalogs.
69+
# Usually you set "language" from the command line for these cases.
70+
language = "en"
71+
72+
# List of patterns, relative to source directory, that match files and
73+
# directories to ignore when looking for source files.
74+
# This pattern also affects html_static_path and html_extra_path.
75+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
76+
77+
# The name of the Pygments (syntax highlighting) style to use.
78+
pygments_style = None
79+
80+
81+
# -- Options for HTML output -------------------------------------------------
82+
83+
# The theme to use for HTML and HTML Help pages. See the documentation for
84+
# a list of builtin themes.
85+
#
86+
html_theme = "sphinxdoc"
87+
88+
# Theme options are theme-specific and customize the look and feel of a theme
89+
# further. For a list of options available for each theme, see the
90+
# documentation.
91+
#
92+
# html_theme_options = {}
93+
94+
# Add any paths that contain custom static files (such as style sheets) here,
95+
# relative to this directory. They are copied after the builtin static files,
96+
# so a file named "default.css" will overwrite the builtin "default.css".
97+
# html_static_path = ["_static"]
98+
html_static_path = []
99+
100+
# Custom sidebar templates, must be a dictionary that maps document names
101+
# to template names.
102+
#
103+
# The default sidebars (for documents that don't match any pattern) are
104+
# defined by theme itself. Builtin themes are using these templates by
105+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
106+
# 'searchbox.html']``.
107+
#
108+
html_sidebars = {"**": ["globaltoc.html", "searchbox.html"]}
109+
110+
111+
# -- Options for HTMLHelp output ---------------------------------------------
112+
113+
# Output file base name for HTML help builder.
114+
htmlhelp_basename = "symspellpydoc"
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
************************
2+
Custom distance comparer
3+
************************
4+
5+
Basic usage
6+
===========
7+
8+
Create a comparer class which satisfies the interface specified by
9+
:class:`~symspellpy.abstract_distance_comparer.AbstractDistanceComparer`:
10+
11+
.. code-block:: python
12+
13+
from symspellpy.abstract_distance_comparer import AbstractDistanceComparer
14+
from symspellpy.editdistance import DistanceAlgorithm, EditDistance
15+
16+
class CustomComparer(AbstractDistanceComparer):
17+
def distance(self, string1, string_2, max_distance):
18+
# Compare distance between string_1 and string_2
19+
return -1 if distance > max_distance else distance
20+
21+
custom_comparer = Editdistance(DistanceAlgorithm.USER_PROVIDED, CustomComparer())
22+
sym_spell = SymSpell(distance_comparer=custom_comparer)
23+
dictionary_path = pkg_resources.resource_filename(
24+
"symspellpy", "frequency_bigramdictionary_en_243_342.txt"
25+
)
26+
sym_spell.load_bigram_dictionary(dictionary_path, 0, 2)
27+
28+
# Print out first 5 elements to demonstrate that dictionary is
29+
# successfully loaded
30+
print(list(islice(sym_spell.bigrams.items(), 5)))

docs/examples/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Examples
88
:maxdepth: 2
99

1010
dictionary.rst
11+
custom_distance_comparer.rst
1112
lookup.rst
1213
lookup_compound.rst
1314
word_segmentation.rst

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
symspellpy
1919
**********
2020

21-
symspellpy is a Python port of SymSpell_ v6.7, a Symmetric Delete
21+
symspellpy is a Python port of SymSpell_ v6.7.2, a Symmetric Delete
2222
spelling correction algorithm which provides much higher speed and lower
2323
memory consumption.
2424

pyproject.toml

+46-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
11
[build-system]
2-
requires = ["setuptools>=58.0.4", "wheel"]
2+
requires = ["setuptools>=61.0.0", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "symspellpy"
7+
dynamic = ["version"]
8+
dependencies = [
9+
"editdistpy>=0.1.3",
10+
]
11+
requires-python = ">=3.8"
12+
authors = [
13+
{name = "mmb L"},
14+
]
15+
description = "Python SymSpell"
16+
readme = "README.md"
17+
license = {file = "LICENSE"}
18+
keywords = ["spellchecker", "symspell", "word segmentation"]
19+
classifiers = [
20+
"Development Status :: 4 - Beta",
21+
"Intended Audience :: Developers",
22+
"Intended Audience :: Education",
23+
"Natural Language :: English",
24+
"License :: OSI Approved :: MIT License",
25+
"Programming Language :: Python",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3.8",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
]
33+
34+
[project.urls]
35+
Repository = "https://github.com/mammothb/symspellpy"
36+
Documentation = "https://symspellpy.readthedocs.io/en/latest"
37+
Changelog = "https://github.com/mammothb/symspellpy/blob/master/CHANGELOG.md"
38+
539
[tool.basedpyright]
40+
ignore = ["tests"]
641
pythonVersion = "3.8"
742

843
reportUnusedCallResult = "none"
@@ -17,3 +52,13 @@ indent-style = "space"
1752
line-ending = "auto"
1853
quote-style = "double"
1954
skip-magic-trailing-comma = false
55+
56+
[tool.setuptools.dynamic]
57+
version = {attr = "symspellpy.__version__"}
58+
59+
[tool.setuptools.packages.find]
60+
where = ["."]
61+
include = ["symspellpy"]
62+
63+
[tool.setuptools.package-data]
64+
symspellpy = ["frequency_*.txt"]

0 commit comments

Comments
 (0)