Rename util.py -> expressions.py

This commit is contained in:
stephenmk 2023-04-22 21:01:52 -05:00
parent 886faf1984
commit 934f6534f1
No known key found for this signature in database
GPG key ID: B6DA730DB06235F1
3 changed files with 4 additions and 6 deletions

View file

@ -2,7 +2,7 @@ import re
from datetime import datetime, date
from bs4 import BeautifulSoup
import bot.util as Util
import bot.expressions as Expressions
class JitenonEntry:
@ -77,7 +77,7 @@ class JitenonEntry:
return [m.group(1)]
m = re.search(r"^[ぁ-ヿ、]+[ぁ-ヿ、][ぁ-ヿ、]+$", yomikata)
if m:
return Util.expand_shouryaku(yomikata)
return Expressions.expand_shouryaku(yomikata)
m = re.search(r"^([ぁ-ヿ、]+)([ぁ-ヿ/\s、]+)$", yomikata)
if m:
yomikatas = [m.group(1)]

View file

@ -4,10 +4,7 @@ import re
def expand_shouryaku(shouryaku):
"""Return a list of words described by a 省略 notation.
eg. "有(り)合(わ)せ" -> [
"有り合わせ",
"有合わせ",
"有り合せ",
"有合せ"
"有り合わせ", "有合わせ", "有り合せ", "有合せ"
]
"""
groups = re.findall(r"([^]*)(([^]+))?", shouryaku)

View file

@ -1,3 +1,4 @@
import re
from css_parser import parseStyle