Gather data

This commit is contained in:
mike
2025-12-25 00:21:58 +01:00
parent 85ebfd3013
commit 49a1aa4152
12 changed files with 494 additions and 27933 deletions

View File

@@ -145,7 +145,7 @@ public class SwedishGenerator {
// Base difficulty starts high and decreases with length and score.
// Length impact: up to 8 * 10 = 80
// Score impact: up to 10 * 15 = 150
var difficulty1 = 0 + ((8 - word.length()) * 30) + ((10-score) * 15);
var difficulty1 = 0 + ((8 - word.length()) * 30) + ((10 - score) * 15);
this.difficulty = difficulty1;
}
}
@@ -153,24 +153,19 @@ public class SwedishGenerator {
static Map<String, Integer> loadScores() {
var scores = new HashMap<String, Integer>();
try {
var lines = Files.readAllLines(Path.of("word_scores.csv"), StandardCharsets.UTF_8);
var lines = Files.readAllLines(Path.of("export_words.csv"), StandardCharsets.UTF_8);
var first = true;
for (var line : lines) {
if (first) {
first = false;
continue;
}
var parts = line.split("," );
if (parts.length >= 3) {
var parts = line.split(",");
if (parts.length >= 2) {
try {
var word = parts[0].trim().toUpperCase(Locale.ROOT);
var score = Integer.parseInt(parts[1].trim());
var status = parts[2].trim();
if ("OK".equalsIgnoreCase(status)) {
scores.put(word, score);
} else {
System.err.println("Skipping:" +Arrays.toString( parts));
}
scores.put(word, score);
} catch (NumberFormatException ignored) {
System.err.println("Illegal number format: " + line);
}
@@ -906,7 +901,7 @@ public class SwedishGenerator {
var tLoad0 = System.nanoTime();
var dict = loadWords(opts.wordsPath, llmScores);
var tLoad1 = System.nanoTime();
System.out.printf(Locale.ROOT, "LOAD_WORDS: %.3fs%n %s words", (tLoad1 - tLoad0) / 1e9,dict.words.size());
System.out.printf(Locale.ROOT, "LOAD_WORDS: %.3fs%n %s words", (tLoad1 - tLoad0) / 1e9, dict.words.size());
for (var attempt = 1; attempt <= opts.tries; attempt++) {
System.out.println("\nAttempt " + attempt + "/" + opts.tries);