Skip to content

Commit

Permalink
Merge pull request #160 from mammothb/dev
Browse files Browse the repository at this point in the history
build: prepare 6.7.8 release
  • Loading branch information
mammothb authored Aug 31, 2024
2 parents 7326ddd + 9e08dc3 commit a4cc77b
Show file tree
Hide file tree
Showing 24 changed files with 314 additions and 232 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

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

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ symspellpy <br>
[![codecov](https://codecov.io/gh/mammothb/symspellpy/branch/master/graph/badge.svg)](https://codecov.io/gh/mammothb/symspellpy)
========

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
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
from the original project are implemented to ensure the accuracy of the port.

Please note that the port has not been optimized for speed.
Expand Down
9 changes: 9 additions & 0 deletions docs/api/abstract_distance_comparer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**************************
abstract_distance_comparer
**************************

Distance comparer interface
===========================

.. autoclass:: symspellpy.abstract_distance_comparer.AbstractDistanceComparer
:members:
3 changes: 0 additions & 3 deletions docs/api/editdistance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ EditDistance class
Distance comparer classes
=========================

.. autoclass:: symspellpy.editdistance.AbstractDistanceComparer
:members:

.. autoclass:: symspellpy.editdistance.DamerauOsa
:members:

Expand Down
1 change: 1 addition & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ Modules
:maxdepth: 2

helpers.rst
abstract_distance_comparer.rst
editdistance.rst
symspellpy.rst
227 changes: 114 additions & 113 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,113 +1,114 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

import os.path
import sys

sys.path.insert(0, os.path.abspath(".."))

import symspellpy

# -- Project information -----------------------------------------------------

project = "symspellpy"
copyright = "2021, mmb L, Wolf Garbe"
author = "mmb L, Wolf Garbe"

# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = symspellpy.__version__


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx_autodoc_typehints",
]
# numpydoc_class_members_toctree = False
# numpydoc_show_inherited_class_members = False
highlight_language = "none"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinxdoc"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
html_sidebars = {"**": ["globaltoc.html", "searchbox.html"]}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = "symspellpydoc"
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

import os.path
import sys

sys.path.insert(0, os.path.abspath(".."))

import symspellpy

# -- Project information -----------------------------------------------------

project = "symspellpy"
copyright = "2021, mmb L, Wolf Garbe"
author = "mmb L, Wolf Garbe"

# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = symspellpy.__version__


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx_autodoc_typehints",
]
# numpydoc_class_members_toctree = False
# numpydoc_show_inherited_class_members = False
highlight_language = "none"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinxdoc"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ["_static"]
html_static_path = []

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
html_sidebars = {"**": ["globaltoc.html", "searchbox.html"]}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = "symspellpydoc"
30 changes: 30 additions & 0 deletions docs/examples/custom_distance_comparer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
************************
Custom distance comparer
************************

Basic usage
===========

Create a comparer class which satisfies the interface specified by
:class:`~symspellpy.abstract_distance_comparer.AbstractDistanceComparer`:

.. code-block:: python
from symspellpy.abstract_distance_comparer import AbstractDistanceComparer
from symspellpy.editdistance import DistanceAlgorithm, EditDistance
class CustomComparer(AbstractDistanceComparer):
def distance(self, string1, string_2, max_distance):
# Compare distance between string_1 and string_2
return -1 if distance > max_distance else distance
custom_comparer = Editdistance(DistanceAlgorithm.USER_PROVIDED, CustomComparer())
sym_spell = SymSpell(distance_comparer=custom_comparer)
dictionary_path = pkg_resources.resource_filename(
"symspellpy", "frequency_bigramdictionary_en_243_342.txt"
)
sym_spell.load_bigram_dictionary(dictionary_path, 0, 2)
# Print out first 5 elements to demonstrate that dictionary is
# successfully loaded
print(list(islice(sym_spell.bigrams.items(), 5)))
1 change: 1 addition & 0 deletions docs/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Examples
:maxdepth: 2

dictionary.rst
custom_distance_comparer.rst
lookup.rst
lookup_compound.rst
word_segmentation.rst
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
symspellpy
**********

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

Expand Down
47 changes: 46 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
[build-system]
requires = ["setuptools>=58.0.4", "wheel"]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "symspellpy"
dynamic = ["version"]
dependencies = [
"editdistpy>=0.1.3",
]
requires-python = ">=3.8"
authors = [
{name = "mmb L"},
]
description = "Python SymSpell"
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["spellchecker", "symspell", "word segmentation"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.urls]
Repository = "https://github.com/mammothb/symspellpy"
Documentation = "https://symspellpy.readthedocs.io/en/latest"
Changelog = "https://github.com/mammothb/symspellpy/blob/master/CHANGELOG.md"

[tool.basedpyright]
ignore = ["tests"]
pythonVersion = "3.8"

reportUnusedCallResult = "none"
Expand All @@ -17,3 +52,13 @@ indent-style = "space"
line-ending = "auto"
quote-style = "double"
skip-magic-trailing-comma = false

[tool.setuptools.dynamic]
version = {attr = "symspellpy.__version__"}

[tool.setuptools.packages.find]
where = ["."]
include = ["symspellpy"]

[tool.setuptools.package-data]
symspellpy = ["frequency_*.txt"]
Loading

0 comments on commit a4cc77b

Please sign in to comment.