diverse aanpassingen

This commit is contained in:
Peter Kleiweg
2026-04-22 19:02:34 +02:00
parent c6c2abb387
commit 9d974b3725
6 changed files with 68 additions and 39 deletions

View File

@@ -27,18 +27,12 @@ type Data struct {
}
type Parts struct {
NieuweNamen [][3]any `json:"nieuwe namen"`
NieuweWoorden [][3]any `json:"nieuwe woorden"`
Personen [][3]any `json:"personen"`
AndereNamen [][3]any `json:"andere namen"`
Locaties [][3]any `json:"locaties"`
Organisaties [][3]any `json:"organisaties"`
}
type Value struct {
Word string `json:"word"`
Tags string `json:"tags"`
Count int `json:"count"`
NieuweNamen [][5]any `json:"nieuwe namen"`
NieuweWoorden [][5]any `json:"nieuwe woorden"`
Personen [][5]any `json:"personen"`
AndereNamen [][5]any `json:"andere namen"`
Locaties [][5]any `json:"locaties"`
Organisaties [][5]any `json:"organisaties"`
}
var (
@@ -55,7 +49,7 @@ var (
suffix string
}{
"nieuwe namen": {"nieuwe-namen", ".t20"},
"nieuwe woorden": {"nieuwe-woorden", ".t20"},
"nieuwe woorden": {"nieuwe-woorden-extra", ".t20"},
"personen": {"personen", ""},
"andere namen": {"overige-namen", ""},
"locaties": {"locaties", ""},
@@ -127,8 +121,8 @@ func makeParts(source string) *Parts {
}
}
func makeValues(source, part string) [][3]any {
v := make([][3]any, 0)
func makeValues(source, part string) [][5]any {
v := make([][5]any, 0)
filename := fmt.Sprintf("/net/corpora/nlnieuws/data/%s-%s-%d-%02d-%d%s",
sources[source],
@@ -149,11 +143,17 @@ func makeValues(source, part string) [][3]any {
count, err := strconv.Atoi(strings.TrimSpace(aa[0]))
x(err)
word := aa[1]
var tags string
var tags, lemma, postag string
if len(aa) > 2 {
tags = aa[2]
}
v = append(v, [3]any{count, word, tags})
if len(aa) > 3 {
lemma = aa[3]
}
if len(aa) > 4 {
postag = aa[4]
}
v = append(v, [5]any{count, word, tags, lemma, postag})
if lineno == 20 {
break
}
@@ -173,7 +173,7 @@ func dates() (start, first, last string) {
// zoek juiste week
var y, w int
for {
y, w = t.ISOWeek()
y, _ = t.ISOWeek()
if y < year {
t = t.AddDate(0, 12, 0)
continue