Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
barrust committed Jan 15, 2024
1 parent 0b47329 commit ffd3f4e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pyspellchecker

## Version 0.7.4
## Version 0.8.0

* Leveraged the dictionary files from [levidromelist](https://www.levidromelist.com/levidrome-list/dictionary) to attempt to clean up the `en`, `es`, `fr`, `pt`, `'de`, and `nl`dictionaries; Attempts to resolve issues #164, #155, #150, #140, #115, and #107; see [issue #126](https://github.com/barrust/pyspellchecker/issues/126)
* Added `Italian` language support; see [#167](https://github.com/barrust/pyspellchecker/pull/167)
Expand Down
23 changes: 10 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[project]
name = "pyspellchecker"
dynamic = ["version"]
authors = [{name = "Tyler Barrus", email = "barrust@gmail.com"}]
license = {text = "MIT"}
authors = [{ name = "Tyler Barrus", email = "barrust@gmail.com" }]
license = { text = "MIT" }
description = "Pure python spell checker based on work by Peter Norvig"
keywords = [
"python",
Expand Down Expand Up @@ -30,12 +30,13 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.6"


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


[project.urls]
Expand All @@ -45,16 +46,14 @@ documentation = "https://pyspellchecker.readthedocs.io/"


[tool.poetry]
packages = [
{include = "spellchecker"},
]
packages = [{ include = "spellchecker" }]

[tool.poetry.dev-dependencies]
pre-commit = {version = ">=2.18.1", python = "^3.6.1"}
black = {version = "^20.8b1", python = "^3.6"}
isort = {version = "^5.6.4", python = "^3.6"}
pytest = {version = "^6.1.1", python = "^3.6"}
flake8 = {version = "^3.6.0", python = "^3.6"}
pre-commit = { version = ">=2.18.1", python = "^3.6.1" }
black = { version = "^20.8b1", python = "^3.6" }
isort = { version = "^5.6.4", python = "^3.6" }
pytest = { version = "^6.1.1", python = "^3.6" }
flake8 = { version = "^3.6.0", python = "^3.6" }

[tool.setuptools.packages.find]
include = ["spellchecker", "spellchecker.*"]
Expand Down Expand Up @@ -89,5 +88,3 @@ max-args = 6
[build-system]
requires = ["setuptools>=61.2.0", "wheel"]
build-backend = "setuptools.build_meta"


2 changes: 1 addition & 1 deletion spellchecker/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__maintainer__ = "Tyler Barrus"
__email__ = "barrust@gmail.com"
__license__ = "MIT"
__version__ = "0.7.3"
__version__ = "0.8.0"
__credits__ = ["Peter Norvig"]
__url__ = "https://github.com/barrust/pyspellchecker"
__bugtrack_url__ = f"{__url__}/issues"
18 changes: 10 additions & 8 deletions spellchecker/spellchecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,16 @@ def __init__(
tokenizer: typing.Optional[typing.Callable[[str], typing.Iterable[str]]] = None,
case_sensitive: bool = False,
) -> None:
self._dictionary = Counter()
self._dictionary: typing.Counter = Counter()
self._total_words = 0
self._unique_words = 0
self._letters = set()
self._letters: typing.Set[str] = set()
self._case_sensitive = case_sensitive
self._longest_word_length = 0

self._tokenizer = _parse_into_words
if tokenizer is not None:
self._tokenizer = tokenizer
self._tokenizer = tokenizer # type: ignore

def __contains__(self, key: KeyT) -> bool:
"""turn on contains"""
Expand All @@ -313,13 +313,15 @@ def __iter__(self) -> typing.Generator[str, None, None]:
"""turn on iter support"""
yield from self._dictionary

def pop(self, key: KeyT, default: typing.Optional[int] = None) -> int:
def pop(self, key: KeyT, default: typing.Optional[int] = None) -> typing.Optional[int]:
"""Remove the key and return the associated value or default if not
found
Args:
key (str): The key to remove
default (obj): The value to return if key is not present"""
default (obj): The value to return if key is not present
Returns:
int | None: Returns the number of instances of key, or None if not in the dictionary"""
key = ensure_unicode(key)
return self._dictionary.pop(key if self._case_sensitive else key.lower(), default)

Expand Down Expand Up @@ -364,7 +366,7 @@ def longest_word_length(self) -> int:
Not settable"""
return self._longest_word_length

def tokenize(self, text: KeyT) -> typing.Generator[str, None, None]:
def tokenize(self, text: KeyT) -> typing.Iterator[str]:
"""Tokenize the provided string object into individual words
Args:
Expand All @@ -377,7 +379,7 @@ def tokenize(self, text: KeyT) -> typing.Generator[str, None, None]:
for word in self._tokenizer(tmp_text):
yield word if self._case_sensitive else word.lower()

def keys(self) -> typing.Generator[str, None, None]:
def keys(self) -> typing.Iterator[str]:
"""Iterator over the key of the dictionary
Yields:
Expand All @@ -386,7 +388,7 @@ def keys(self) -> typing.Generator[str, None, None]:
This is the same as `spellchecker.words()`"""
yield from self._dictionary.keys()

def words(self) -> typing.Generator[str, None, None]:
def words(self) -> typing.Iterator[str]:
"""Iterator over the words in the dictionary
Yields:
Expand Down

0 comments on commit ffd3f4e

Please sign in to comment.