1
This commit is contained in:
Alex Yatskov 2016-12-17 17:08:38 -08:00
parent 879a3828b3
commit d62e1cc2c0
2 changed files with 17 additions and 31 deletions

View File

@ -32,10 +32,7 @@ import (
func computeJmdictRules(term *dbTerm) { func computeJmdictRules(term *dbTerm) {
for _, tag := range term.Tags { for _, tag := range term.Tags {
switch tag { switch tag {
case "adj-i": case "adj-i", "v1", "vk", "vs":
case "v1":
case "vk":
case "vs":
term.addRules(tag) term.addRules(tag)
default: default:
if strings.HasPrefix(tag, "v5") { if strings.HasPrefix(tag, "v5") {
@ -49,37 +46,37 @@ func computeJmdictScore(term *dbTerm) {
term.Score = 0 term.Score = 0
for _, tag := range term.Tags { for _, tag := range term.Tags {
switch tag { switch tag {
case "gai1": case "gai1", "ichi1", "news1", "spec1":
case "ichi1":
case "news1":
case "spec1":
term.Score += 5 term.Score += 5
case "arch": case "arch", "iK":
case "iK":
term.Score -= 1 term.Score -= 1
} }
} }
} }
func computeJmdictTagMeta(entities map[string]string) map[string]dbTagMeta { func computeJmdictTagMeta(entities map[string]string) map[string]dbTagMeta {
tags := make(map[string]dbTagMeta) tags := map[string]dbTagMeta{
"news1": {Notes: "appears frequently in Mainichi Shimbun (top listing)", Class: "frequent", Order: 3},
"ichi1": {Notes: "listed as common in Ichimango Goi Bunruishuu (top listing)", Class: "frequent", Order: 3},
"spec1": {Notes: "common words not included in frequency lists (top listing)", Class: "frequent", Order: 3},
"gai1": {Notes: "common loanword (top listing)", Class: "frequent", Order: 3},
"news2": {Notes: "appears frequently in Mainichi Shimbun (bottom listing)", Order: 3},
"ichi2": {Notes: "listed as common in Ichimango Goi Bunruishuu (bottom listing)", Order: 3},
"spec2": {Notes: "common words not included in frequency lists (bottom listing)", Order: 3},
"gai2": {Notes: "common loanword (bottom listing)", Order: 3},
}
for name, value := range entities { for name, value := range entities {
tag := dbTagMeta{Notes: value} tag := dbTagMeta{Notes: value}
switch name { switch name {
case "gai1": case "gai1", "ichi1", "news1", "spec1":
case "ichi1":
case "news1":
case "spec1":
tag.Class = "frequent" tag.Class = "frequent"
tag.Order = 1 tag.Order = 1
case "exp": case "exp", "id":
case "id":
tag.Class = "expression" tag.Class = "expression"
tag.Order = 2 tag.Order = 2
case "arch": case "arch", "iK":
case "iK":
tag.Class = "archaism" tag.Class = "archaism"
tag.Order = 2 tag.Order = 2
} }

View File

@ -35,18 +35,7 @@ func computeJmnedictTagMeta(entities map[string]string) map[string]dbTagMeta {
tag := dbTagMeta{Notes: value} tag := dbTagMeta{Notes: value}
switch name { switch name {
case "company": case "company", "fem", "given", "masc", "organization", "person", "place", "product", "station", "surname", "unclass", "work":
case "fem":
case "given":
case "masc":
case "organization":
case "person":
case "place":
case "product":
case "station":
case "surname":
case "unclass":
case "work":
tag.Class = "name" tag.Class = "name"
tag.Order = 4 tag.Order = 4
} }