Handle special headword case
This commit is contained in:
parent
f7cfc7915b
commit
be47717638
|
@ -2,7 +2,7 @@ import re
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
import yomichan.soup as YomichanSoup
|
import yomichan.html_gloss as YomichanGloss
|
||||||
import util as Util
|
import util as Util
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class Jitenon:
|
||||||
colval = self.__clean(row.td.text)
|
colval = self.__clean(row.td.text)
|
||||||
self.__set_column(colname, colval)
|
self.__set_column(colname, colval)
|
||||||
self.__prepare_yomichan_soup(table)
|
self.__prepare_yomichan_soup(table)
|
||||||
gloss = YomichanSoup.make_gloss(table)
|
gloss = YomichanGloss.make_gloss(table)
|
||||||
self.yomichan_glossary = [gloss]
|
self.yomichan_glossary = [gloss]
|
||||||
|
|
||||||
def __set_modified_date(self, html):
|
def __set_modified_date(self, html):
|
||||||
|
@ -54,7 +54,6 @@ class Jitenon:
|
||||||
setattr(self, attr_name, [colval])
|
setattr(self, attr_name, [colval])
|
||||||
else:
|
else:
|
||||||
attr_value.append(colval)
|
attr_value.append(colval)
|
||||||
# setattr(self, attr_name, attr_value)
|
|
||||||
|
|
||||||
def __prepare_yomichan_soup(self, soup):
|
def __prepare_yomichan_soup(self, soup):
|
||||||
patterns = [
|
patterns = [
|
||||||
|
@ -74,6 +73,9 @@ class Jitenon:
|
||||||
|
|
||||||
def _headwords(self):
|
def _headwords(self):
|
||||||
words = []
|
words = []
|
||||||
|
if self.expression == "金棒引き・鉄棒引き":
|
||||||
|
# special case
|
||||||
|
return [["金棒引き", "かなぼうひき"], ["金棒引き", "かなぼうひき"]]
|
||||||
for yomikata in self.__yomikatas():
|
for yomikata in self.__yomikatas():
|
||||||
headword = [self.expression, yomikata]
|
headword = [self.expression, yomikata]
|
||||||
if headword in words:
|
if headword in words:
|
||||||
|
|
Loading…
Reference in a new issue