introduce bitloops

This commit is contained in:
mike
2026-01-20 12:08:48 +01:00
parent 8780a26451
commit 58b8b57688
29 changed files with 136135 additions and 39251 deletions

View File

@@ -24,8 +24,8 @@ public class BuildMeta2 {
if (line.isBlank()) {
throw new RuntimeException("Empty line");
}
var parts = line.split(",", 5);
var word = parts[1].trim();
var parts = line.split(",", 4);
var word = parts[0].trim();
ok.accept(SwedishGenerator.Lemma.from(word.getBytes(US_ASCII)));
}
// --- Build demo files: shard.data + shard.map ---
@@ -86,8 +86,8 @@ public class BuildMeta2 {
}
}
public static void main2(String[] args) throws Exception {
val records = buildDict(Path.of("nl_score_hints_v3.csv"));
public static void main(String[] args) throws Exception {
val records = buildDict(Path.of("nl_score_hints_v4.csv"));
buildShard(Meta.shardData, Meta.shardMap, records);
@@ -110,7 +110,7 @@ public class BuildMeta2 {
System.out.println(" " + Meta.shardData);
System.out.println(" " + Meta.shardMap);
} // --- Demo main ---
public static void main(String[] args) throws Exception {
public static void main1(String[] args) throws Exception {
for (String qRaw : List.of("FIETS", "HUIS", "KIWI")) {
long w = Lemma.from(qRaw) | (3897L << 43L);

View File

@@ -18,7 +18,7 @@ public final class DictJavaGeneratorMulti {
private static final int POS_CHUNK = 8_192;
public static void main(String[] args) throws Exception {
Path wordsFile = Path.of(args.length > 0 ? args[0] : "nl_score_hints_v3.csv");
Path wordsFile = Path.of(args.length > 0 ? args[0] : "nl_score_hints_v4.csv");
Path outDir = Path.of(args.length > 1 ? args[1] : "src/main/generated-sources/puzzle/dict" + THRESS);
String pkg = "puzzle.dict" + THRESS;
HashMap<String, ShardBuilder> builders = new HashMap<String, ShardBuilder>(16);
@@ -277,16 +277,16 @@ public final class DictJavaGeneratorMulti {
}
public static final class CsvIndexService {
static int SIMPEL_IDX = 3;
static int SIMPEL_IDX = 2;
public static int lineToSimpel(String line) {
var parts = line.split(",", 5);
var parts = line.split(",", 4);
return Integer.parseInt(parts[SIMPEL_IDX].trim());
}
public static String[] lineToClue(String line) {
if (line.isBlank()) throw new RuntimeException("Empty line");
var parts = line.split(",", 5);
var rawClue = parts[4].trim();
var parts = line.split(",", 4);
var rawClue = parts[3].trim();
if (rawClue.startsWith("\"") && rawClue.endsWith("\"")) {
rawClue = rawClue.substring(1, rawClue.length() - 1).replace("\"\"", "\"");
}
@@ -296,11 +296,10 @@ public final class DictJavaGeneratorMulti {
if (line.isBlank()) {
throw new RuntimeException("Empty line");
}
var parts = line.split(",", 5);
var id = Integer.parseInt(parts[0].trim());
var word = parts[1].trim();
int score = Integer.parseInt(parts[2].trim());
int simpel = Integer.parseInt(parts[3].trim());
var parts = line.split(",", 4);
var word = parts[0].trim();
int score = Integer.parseInt(parts[1].trim());
int simpel = Integer.parseInt(parts[2].trim());
if (score < 1 || simpel > THRESS) {
if (Main.VERBOSE) System.err.println("Word too complex: " + line);
return;

View File

@@ -154,11 +154,11 @@ public class ExportFormatTest {
// Check some expected complexity values (from CSV head output, column 3)
if (wStr.equals("EEN")) {
assertEquals(451, clueRec.simpel());
assertEquals("het getal 1", clueRec.clues()[0]);
assertEquals("een geheel vormend", clueRec.clues()[0]);
}
if (wStr.equals("NAAR")) {
assertEquals(497, clueRec.simpel());
assertEquals("in de richting van", clueRec.clues()[0]);
assertEquals("onaangenaam, vervelend, rot, niet leuk", clueRec.clues()[0]);
}
if (wStr.equals("IEDEREEN")) {
assertEquals(501, clueRec.simpel());