瀏覽代碼

Handle all of the 'x of y' as a single case.

tags/v0.1^2
Ben Kurtovic 12 年之前
父節點
當前提交
d321cd8a14
共有 1 個檔案被更改,包括 3 行新增4 行删除
  1. +3
    -4
      earwigbot/commands/dictionary.py

+ 3
- 4
earwigbot/commands/dictionary.py 查看文件

@@ -127,9 +127,7 @@ class Dictionary(Command):
substitutions = [
("<!--(.*?)-->", ""),
("\[\[(.*?)\|(.*?)\]\]", r"\2"),
("\{\{alternative spelling of\|(.*?)\}\}",
r"Alternative spelling of \1."),
("\{\{synonym of\|(.*?)\}\}", r"Synonym of \1."),
("\{\{(.*?) of\|(.*?)\}\}", r"\1 of \2."),
("\{\{surname(.*?)\}\}", r"A surname."),
("\{\{given name\|(.*?)(\||\}\})", r"A \1 given name."),
]
@@ -143,7 +141,8 @@ class Dictionary(Command):
line = self.strip_templates(line)
line = line[1:].replace("'''", "").replace("''", "")
line = line.replace("[[", "").replace("]]", "")
senses.append(line.strip())
if line:
senses.append(line.strip()[0].upper() + line.strip()[1:])

if not senses:
return None


Loading…
取消
儲存