项目文件夹

文件
wehub-resource-sync f877c37fc6
tests / Test (windows-latest, 3.13) (push) Has been cancelled
tests / Test (windows-latest, 3.14) (push) Has been cancelled
tests / Validate (push) Has been cancelled
tests / Test (macos-latest, 3.10) (push) Has been cancelled
tests / Test (macos-latest, 3.11) (push) Has been cancelled
tests / Test (macos-latest, 3.12) (push) Has been cancelled
tests / Test (macos-latest, 3.13) (push) Has been cancelled
tests / Test (macos-latest, 3.14) (push) Has been cancelled
tests / Test (ubuntu-latest, 3.10) (push) Has been cancelled
tests / Test (ubuntu-latest, 3.11) (push) Has been cancelled
tests / Test (ubuntu-latest, 3.12) (push) Has been cancelled
tests / Test (ubuntu-latest, 3.13) (push) Has been cancelled
tests / Test (ubuntu-latest, 3.14) (push) Has been cancelled
tests / Test (windows-latest, 3.10) (push) Has been cancelled
tests / Test (windows-latest, 3.11) (push) Has been cancelled
tests / Test (windows-latest, 3.12) (push) Has been cancelled
universe validation / Validate (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:37:51 +08:00

77 行
2.3 KiB
Python

from ...attrs import LIKE_NUM
# reference 2: https://www.omniglot.com/language/numbers/malayalam.htm
_num_words = [
"പൂജ്യം ",
"ഒന്ന് ",
"രണ്ട് ",
"മൂന്ന് ",
"നാല്‌ ",
"അഞ്ച് ",
"ആറ് ",
"ഏഴ് ",
"എട്ട് ",
"ഒന്‍പത് ",
"പത്ത് ",
"പതിനൊന്ന്",
"പന്ത്രണ്ട്",
"പതി മൂന്നു",
"പതിനാല്",
"പതിനഞ്ച്",
"പതിനാറ്",
"പതിനേഴ്",
"പതിനെട്ട്",
"പത്തൊമ്പതു",
"ഇരുപത്",
"ഇരുപത്തിഒന്ന്",
"ഇരുപത്തിരണ്ട്‌",
"ഇരുപത്തിമൂന്ന്",
"ഇരുപത്തിനാല്",
"ഇരുപത്തിഅഞ്ചു",
"ഇരുപത്തിആറ്",
"ഇരുപത്തിഏഴ്",
"ഇരുപത്തിഎട്ടു",
"ഇരുപത്തിഒന്‍പത്",
"മുപ്പത്",
"മുപ്പത്തിഒന്ന്",
"മുപ്പത്തിരണ്ട്",
"മുപ്പത്തിമൂന്ന്",
"മുപ്പത്തിനാല്",
"മുപ്പത്തിഅഞ്ചു",
"മുപ്പത്തിആറ്",
"മുപ്പത്തിഏഴ്",
"മുപ്പത്തിഎട്ട്",
"മുപ്പത്തിഒന്‍പതു",
"നാല്‍പത്‌ ",
"അന്‍പത് ",
"അറുപത് ",
"എഴുപത് ",
"എണ്‍പത് ",
"തൊണ്ണൂറ് ",
"നുറ് ",
"ആയിരം ",
"പത്തുലക്ഷം",
]
def like_num(text):
"""
Check if text resembles a number
"""
if text.startswith(("+", "-", "±", "~")):
text = text[1:]
text = text.replace(",", "").replace(".", "")
if text.isdigit():
return True
if text.count("/") == 1:
num, denom = text.split("/")
if num.isdigit() and denom.isdigit():
return True
if text in _num_words:
return True
return False
LEX_ATTRS = {LIKE_NUM: like_num}