expand keyword tests
This commit is contained in:
parent
414f5df5ae
commit
a0afb916e7
1 changed files with 87 additions and 50 deletions
137
nomen/utils.py
137
nomen/utils.py
|
@ -1,55 +1,15 @@
|
||||||
import logging
|
import logging
|
||||||
from asyncio import TimeoutError
|
from asyncio import TimeoutError
|
||||||
from itertools import chain
|
|
||||||
|
|
||||||
import re2 as re
|
import re2 as re
|
||||||
from disnake.ext.commands import BadArgument
|
from disnake.ext.commands import BadArgument
|
||||||
|
|
||||||
log = logging.getLogger("nomen.utils")
|
log = logging.getLogger("nomen.utils")
|
||||||
|
|
||||||
ALPHABET = list("abcdefghijklmnopqrstuvwxyz ")
|
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
|
||||||
|
SYMBOLS = "!@#$%^&*()[]{}-_=+`~;:'\"/\\"
|
||||||
|
|
||||||
COMMON_WORDS = [
|
PRONOUNS = [
|
||||||
# common words
|
|
||||||
"of",
|
|
||||||
"in",
|
|
||||||
"is",
|
|
||||||
"to",
|
|
||||||
"it",
|
|
||||||
"as",
|
|
||||||
"on",
|
|
||||||
"by",
|
|
||||||
"or",
|
|
||||||
"be",
|
|
||||||
"an",
|
|
||||||
"at",
|
|
||||||
"if",
|
|
||||||
"up",
|
|
||||||
"so",
|
|
||||||
"do",
|
|
||||||
"th",
|
|
||||||
"no",
|
|
||||||
"de",
|
|
||||||
"the",
|
|
||||||
"and",
|
|
||||||
"was",
|
|
||||||
"for",
|
|
||||||
"that",
|
|
||||||
"are",
|
|
||||||
"with",
|
|
||||||
"from",
|
|
||||||
"this",
|
|
||||||
"not",
|
|
||||||
"also",
|
|
||||||
"has",
|
|
||||||
"were",
|
|
||||||
"which",
|
|
||||||
"have",
|
|
||||||
"people",
|
|
||||||
"one",
|
|
||||||
"can",
|
|
||||||
"help",
|
|
||||||
# pronouns
|
|
||||||
"you",
|
"you",
|
||||||
"your",
|
"your",
|
||||||
"yours",
|
"yours",
|
||||||
|
@ -67,15 +27,92 @@ COMMON_WORDS = [
|
||||||
"theirs",
|
"theirs",
|
||||||
"themself",
|
"themself",
|
||||||
"themselves",
|
"themselves",
|
||||||
"a" * 100,
|
"we",
|
||||||
|
"me",
|
||||||
|
"any",
|
||||||
|
"us",
|
||||||
]
|
]
|
||||||
|
|
||||||
TESTS = list(
|
NUMBERS = [
|
||||||
chain(
|
*"0123456789",
|
||||||
ALPHABET, # single letters
|
"10",
|
||||||
COMMON_WORDS,
|
"zero",
|
||||||
)
|
"one",
|
||||||
)
|
"two",
|
||||||
|
"three",
|
||||||
|
"four",
|
||||||
|
"five",
|
||||||
|
"six",
|
||||||
|
"seven",
|
||||||
|
"eight",
|
||||||
|
"nine",
|
||||||
|
"ten",
|
||||||
|
]
|
||||||
|
|
||||||
|
COMMON_WORDS = [
|
||||||
|
"about",
|
||||||
|
"after",
|
||||||
|
"also",
|
||||||
|
"an",
|
||||||
|
"and",
|
||||||
|
"are",
|
||||||
|
"as",
|
||||||
|
"at",
|
||||||
|
"be",
|
||||||
|
"by",
|
||||||
|
"can",
|
||||||
|
"do",
|
||||||
|
"for",
|
||||||
|
"from",
|
||||||
|
"has",
|
||||||
|
"have",
|
||||||
|
"help",
|
||||||
|
"if",
|
||||||
|
"in",
|
||||||
|
"into",
|
||||||
|
"is",
|
||||||
|
"it",
|
||||||
|
"no",
|
||||||
|
"not",
|
||||||
|
"of",
|
||||||
|
"on",
|
||||||
|
"or",
|
||||||
|
"over",
|
||||||
|
"people",
|
||||||
|
"so",
|
||||||
|
"that",
|
||||||
|
"the",
|
||||||
|
"this",
|
||||||
|
"to",
|
||||||
|
"up",
|
||||||
|
"was",
|
||||||
|
"were",
|
||||||
|
"which",
|
||||||
|
"with",
|
||||||
|
]
|
||||||
|
|
||||||
|
COMMON_FRAGMENTS = [
|
||||||
|
"de",
|
||||||
|
"th",
|
||||||
|
"un",
|
||||||
|
]
|
||||||
|
|
||||||
|
WILDCARDS = [
|
||||||
|
"a" * 100, # letters
|
||||||
|
"0" * 100, # numbers
|
||||||
|
" " * 100, # whitespace
|
||||||
|
]
|
||||||
|
|
||||||
|
TESTS = [
|
||||||
|
*ALPHABET,
|
||||||
|
*NUMBERS,
|
||||||
|
*PRONOUNS,
|
||||||
|
*COMMON_WORDS,
|
||||||
|
*COMMON_FRAGMENTS,
|
||||||
|
*WILDCARDS,
|
||||||
|
" ", # single space
|
||||||
|
"\n", # newline
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
regex_cache = {}
|
regex_cache = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue