gone gone
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -45,7 +45,6 @@ VRT/vrt
|
|||||||
bin/data2json
|
bin/data2json
|
||||||
bin/dates2json
|
bin/dates2json
|
||||||
bin/flush
|
bin/flush
|
||||||
bin/gone
|
|
||||||
bin/items2count
|
bin/items2count
|
||||||
bin/rang
|
bin/rang
|
||||||
bin/top20
|
bin/top20
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -21,7 +21,6 @@ all:
|
|||||||
make bin/data2json
|
make bin/data2json
|
||||||
make bin/dates2json
|
make bin/dates2json
|
||||||
make bin/flush
|
make bin/flush
|
||||||
make bin/gone
|
|
||||||
make bin/items2count
|
make bin/items2count
|
||||||
make bin/rang
|
make bin/rang
|
||||||
make bin/top20
|
make bin/top20
|
||||||
@@ -37,9 +36,6 @@ bin/dates2json: cmd/dates2json/*.go
|
|||||||
bin/flush: cmd/flush/*.go
|
bin/flush: cmd/flush/*.go
|
||||||
go build -o $@ $^
|
go build -o $@ $^
|
||||||
|
|
||||||
bin/gone: cmd/gone/*.go
|
|
||||||
go build -o $@ $^
|
|
||||||
|
|
||||||
bin/items2count: cmd/items2count/*.go
|
bin/items2count: cmd/items2count/*.go
|
||||||
go build -o $@ $^
|
go build -o $@ $^
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
e "codeberg.org/pebbe/errors"
|
|
||||||
|
|
||||||
"bufio"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
x = e.ExitErr
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
current := make(map[string]bool)
|
|
||||||
fp, err := os.Open(os.Args[2])
|
|
||||||
x(err)
|
|
||||||
scanner := bufio.NewScanner(fp)
|
|
||||||
for scanner.Scan() {
|
|
||||||
current[strings.Split(scanner.Text(), "\t")[1]] = true
|
|
||||||
}
|
|
||||||
x(scanner.Err())
|
|
||||||
fp.Close()
|
|
||||||
|
|
||||||
var last string
|
|
||||||
fp, err = os.Open(os.Args[1])
|
|
||||||
x(err)
|
|
||||||
scanner = bufio.NewScanner(fp)
|
|
||||||
for scanner.Scan() {
|
|
||||||
aa := strings.Split(scanner.Text(), "\t")
|
|
||||||
if !current[aa[1]] {
|
|
||||||
fmt.Printf("%s\t%s\n", aa[0], aa[1])
|
|
||||||
}
|
|
||||||
last = aa[0]
|
|
||||||
}
|
|
||||||
x(scanner.Err())
|
|
||||||
fp.Close()
|
|
||||||
fmt.Printf("%s\t\n", last)
|
|
||||||
}
|
|
||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
type Item struct {
|
type Item struct {
|
||||||
word string
|
word string
|
||||||
diff float64
|
diff float64
|
||||||
|
gone bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -55,9 +56,11 @@ func main() {
|
|||||||
curmax++
|
curmax++
|
||||||
|
|
||||||
items := make([]Item, 0)
|
items := make([]Item, 0)
|
||||||
|
seen := make(map[string]bool)
|
||||||
|
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
aa := strings.Split(line, "\t")
|
aa := strings.Split(line, "\t")
|
||||||
|
seen[aa[1]] = true
|
||||||
n, err := strconv.Atoi(aa[0])
|
n, err := strconv.Atoi(aa[0])
|
||||||
x(err)
|
x(err)
|
||||||
m, ok := refs[aa[1]]
|
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 {
|
sort.Slice(items, func(a, b int) bool {
|
||||||
if items[a].diff == items[b].diff {
|
if items[a].diff == items[b].diff {
|
||||||
return items[a].word < items[b].word
|
return items[a].word < items[b].word
|
||||||
@@ -82,7 +98,11 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
for _, item := range items {
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user