From d62e1cc2c0a569753305707abddad8e02fb890f6 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 17 Dec 2016 17:08:38 -0800 Subject: [PATCH] Fixes --- edict.go | 35 ++++++++++++++++------------------- enamdict.go | 13 +------------ 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/edict.go b/edict.go index 1f0b0de..a0aa09c 100644 --- a/edict.go +++ b/edict.go @@ -32,10 +32,7 @@ import ( func computeJmdictRules(term *dbTerm) { for _, tag := range term.Tags { switch tag { - case "adj-i": - case "v1": - case "vk": - case "vs": + case "adj-i", "v1", "vk", "vs": term.addRules(tag) default: if strings.HasPrefix(tag, "v5") { @@ -49,37 +46,37 @@ func computeJmdictScore(term *dbTerm) { term.Score = 0 for _, tag := range term.Tags { switch tag { - case "gai1": - case "ichi1": - case "news1": - case "spec1": + case "gai1", "ichi1", "news1", "spec1": term.Score += 5 - case "arch": - case "iK": + case "arch", "iK": term.Score -= 1 } } } 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 { tag := dbTagMeta{Notes: value} switch name { - case "gai1": - case "ichi1": - case "news1": - case "spec1": + case "gai1", "ichi1", "news1", "spec1": tag.Class = "frequent" tag.Order = 1 - case "exp": - case "id": + case "exp", "id": tag.Class = "expression" tag.Order = 2 - case "arch": - case "iK": + case "arch", "iK": tag.Class = "archaism" tag.Order = 2 } diff --git a/enamdict.go b/enamdict.go index 23dd237..40d517e 100644 --- a/enamdict.go +++ b/enamdict.go @@ -35,18 +35,7 @@ func computeJmnedictTagMeta(entities map[string]string) map[string]dbTagMeta { tag := dbTagMeta{Notes: value} switch name { - case "company": - case "fem": - case "given": - case "masc": - case "organization": - case "person": - case "place": - case "product": - case "station": - case "surname": - case "unclass": - case "work": + case "company", "fem", "given", "masc", "organization", "person", "place", "product", "station", "surname", "unclass", "work": tag.Class = "name" tag.Order = 4 }