gone gone

This commit is contained in:
Peter Kleiweg
2026-06-06 21:05:00 +02:00
parent 1f4a084624
commit a9f9e17acf
4 changed files with 21 additions and 47 deletions

View File

@@ -14,6 +14,7 @@ import (
type Item struct {
word string
diff float64
gone bool
}
var (
@@ -55,9 +56,11 @@ func main() {
curmax++
items := make([]Item, 0)
seen := make(map[string]bool)
for _, line := range lines {
aa := strings.Split(line, "\t")
seen[aa[1]] = true
n, err := strconv.Atoi(aa[0])
x(err)
m, ok := refs[aa[1]]
@@ -74,6 +77,19 @@ func main() {
}
}
for key, value := range refs {
if !seen[key] {
diff := float64(value)/float64(refmax) - 1.0
if diff > 0.05 || diff < -0.05 {
items = append(items, Item{
word: key,
diff: diff,
gone: true,
})
}
}
}
sort.Slice(items, func(a, b int) bool {
if items[a].diff == items[b].diff {
return items[a].word < items[b].word
@@ -82,7 +98,11 @@ func main() {
})
for _, item := range items {
fmt.Printf("%f\t%s\n", item.diff, item.word)
var s string
if item.gone {
s = "X"
}
fmt.Printf("%f\t%s\t%s\n", item.diff, s, item.word)
}
}