1

special cases for suru and kuru

This commit is contained in:
Alex Yatskov 2016-12-27 18:30:32 -08:00
parent 4835f58758
commit 2f69ccdbd8

View File

@ -43,9 +43,9 @@ func makeDaijirinExtractor() epwingExtractor {
readGroupExp: regexp.MustCompile(`[-・]+`),
expVarExp: regexp.MustCompile(`\(([^\)]*)\)`),
metaExp: regexp.MustCompile(`([^]*)`),
v5Exp: regexp.MustCompile(`(動.[四五](\[[^\]]+\])?)|(動..二)`),
v5Exp: regexp.MustCompile(`(動.[四五]([^]+)?)|(動..二)`),
v1Exp: regexp.MustCompile(`(動..一)`),
tagExp: regexp.MustCompile(`(動.[四五](\[[^\]]+\])?)|(動..二)|(動..一)|(名)|(形動)|(副)|(連語)|(形)|(枕詞)|(代)|(感)|(接尾)|(助動)|(接続)|(接頭)|(連体)|(終助)|(接助)|(副助)|(係助)|(格助)|(間投助)`),
tagExp: regexp.MustCompile(`(動.[四五]([^]+)?)|(動..二)|(動..一)|(名)|(形動)|(副)|(連語)|(形)|(枕詞)|(代)|(感)|(接尾)|(助動)|(接続)|(接頭)|(連体)|(終助)|(接助)|(副助)|(係助)|(格助)|(間投助)`),
}
}
@ -125,6 +125,12 @@ func (e *daijirinExtractor) exportRules(term *dbTerm, tags []string) {
if tag == "形" {
term.addTags("adj-i")
term.addRules("adj-i")
} else if tag == "動サ変" && (strings.HasSuffix(term.Expression, "する") || strings.HasSuffix(term.Expression, "為る")) {
term.addTags("vs")
term.addRules("vs")
} else if term.Expression == "来る" {
term.addTags("vk")
term.addRules("vk")
} else if e.v5Exp.MatchString(tag) {
term.addTags("v5")
term.addRules("v5")
@ -141,8 +147,8 @@ func (*daijirinExtractor) getRevision() string {
func (e *daijirinExtractor) exportTags(term *dbTerm, tags []string) {
for _, tag := range tags {
if e.tagExp.MatchString(tag) {
term.addTags(tag)
if match := e.tagExp.FindString(tag); match != "" {
term.addTags(match)
}
}
}