Compare commits
4
Commits
release/1.4.0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10daddb54c | ||
|
|
d866b8fbb2 | ||
|
|
61086e0b9b | ||
|
|
ce53920340 |
@@ -1,6 +1,6 @@
|
||||
from cool_domain.word_list import WordList
|
||||
|
||||
LANGS: dict[str, WordList] = {
|
||||
"english": WordList("english", "english/words_alpha.txt"),
|
||||
"french": WordList("french", "french/francais.txt"),
|
||||
"english": WordList("english", "english.txt"),
|
||||
"french": WordList("french", "french.txt"),
|
||||
}
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../english/words_alpha.txt
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../french/francais.txt
|
||||
@@ -1,5 +1,6 @@
|
||||
import logging
|
||||
import pathlib
|
||||
import re
|
||||
import typing
|
||||
|
||||
import unidecode
|
||||
@@ -11,7 +12,7 @@ class WordList:
|
||||
def __init__(self, name: str, path: str) -> None:
|
||||
self.logger: logging.Logger = logging.getLogger(self.__class__.__name__)
|
||||
self.__name = name
|
||||
self.__filepath = pathlib.Path(__file__).parent / ".." / path
|
||||
self.__filepath = pathlib.Path(__file__).parent / path
|
||||
self.words: list[str] = []
|
||||
|
||||
def open(self) -> None:
|
||||
@@ -22,10 +23,7 @@ class WordList:
|
||||
self.logger.info("[%s] Loaded %d words", self.__name, len(self.words))
|
||||
|
||||
def __escape_word(self, word: str) -> str:
|
||||
word = unidecode.unidecode(word.strip()).lower()
|
||||
if " " in word:
|
||||
return ""
|
||||
return word
|
||||
return re.sub(r"[^a-z0-9-]", "", unidecode.unidecode(word.strip()).lower())
|
||||
|
||||
def close(self) -> None:
|
||||
pass
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "cool-domain"
|
||||
version = "1.4.0"
|
||||
version = "1.4.2"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
Reference in New Issue
Block a user