introduce bitloops
This commit is contained in:
@@ -60,7 +60,7 @@ public class Meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- Read record i from shard.data (your format) ---
|
// --- Read record i from shard.data (your format) ---
|
||||||
static ShardLem readRecord(Path shardFile, int i) throws IOException {
|
static ShardLem readRecord(Path shardFile, long w, int i) throws IOException {
|
||||||
try (FileChannel ch = FileChannel.open(shardFile, StandardOpenOption.READ)) {
|
try (FileChannel ch = FileChannel.open(shardFile, StandardOpenOption.READ)) {
|
||||||
ByteBuffer hdr = ByteBuffer.allocate(12).order(ORDER);
|
ByteBuffer hdr = ByteBuffer.allocate(12).order(ORDER);
|
||||||
ch.read(hdr);
|
ch.read(hdr);
|
||||||
@@ -88,7 +88,6 @@ public class Meta {
|
|||||||
String s = StandardCharsets.UTF_8.decode(buf).toString();
|
String s = StandardCharsets.UTF_8.decode(buf).toString();
|
||||||
String[] parts = s.split("\t", 3);
|
String[] parts = s.split("\t", 3);
|
||||||
|
|
||||||
long w = Lemma.from(normWord(parts[0]));
|
|
||||||
int simpel = Integer.parseInt(parts[1]);
|
int simpel = Integer.parseInt(parts[1]);
|
||||||
String[] clues = GSON.fromJson(parts[2], String[].class);
|
String[] clues = GSON.fromJson(parts[2], String[].class);
|
||||||
return new ShardLem(w, simpel, clues);
|
return new ShardLem(w, simpel, clues);
|
||||||
@@ -107,10 +106,9 @@ public class Meta {
|
|||||||
public static ShardLem lookup(long w) {
|
public static ShardLem lookup(long w) {
|
||||||
try {
|
try {
|
||||||
int i = findIndexInMapMmap(shardMap, Lemma.pack43(w));
|
int i = findIndexInMapMmap(shardMap, Lemma.pack43(w));
|
||||||
val qRaw = Lemma.asWord(w, new byte[8]);
|
System.out.println("\nQuery: w=" + w + " -> i=" + i);
|
||||||
System.out.println("\nQuery: " + qRaw + " w=" + w + " -> i=" + i);
|
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
ShardLem rec = readRecord(shardData, i);
|
ShardLem rec = readRecord(shardData, w, i);
|
||||||
System.out.println(" simpel=" + rec.simpel());
|
System.out.println(" simpel=" + rec.simpel());
|
||||||
System.out.println(" clues=" + Arrays.toString(rec.clues()));
|
System.out.println(" clues=" + Arrays.toString(rec.clues()));
|
||||||
return rec;
|
return rec;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class BuildMeta2 {
|
|||||||
|
|
||||||
System.out.println("\nQuery: " + qRaw + " (norm=" + q + ") w=" + w + " -> i=" + i);
|
System.out.println("\nQuery: " + qRaw + " (norm=" + q + ") w=" + w + " -> i=" + i);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
ShardLem rec = Meta.readRecord(Meta.shardData, i);
|
ShardLem rec = Meta.readRecord(Meta.shardData, w, i);
|
||||||
System.out.println(" simpel=" + rec.simpel());
|
System.out.println(" simpel=" + rec.simpel());
|
||||||
System.out.println(" clues=" + Arrays.toString(rec.clues()));
|
System.out.println(" clues=" + Arrays.toString(rec.clues()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user