engine: room for 128 candidates
32 hid the tail of common readings: きょう has 41 kanji, 구 has 352 hanja. 128 covers every kanji entry and the hanja dictionary now keeps that many per reading.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
void
|
||||
dictionary_candidates(struct ct *t)
|
||||
{
|
||||
char many[512], item[8];
|
||||
char many[8*(Maxkouho+1)], item[8];
|
||||
char *p;
|
||||
Str kouho[Maxkouho], key;
|
||||
Trie *saved;
|
||||
@@ -37,7 +37,8 @@ dictionary_candidates(struct ct *t)
|
||||
n = dictlookup(lang, &key, kouho, Maxkouho);
|
||||
if(CT_EQ_INT(t, Maxkouho, n)){
|
||||
checkstr(t, "first capped candidate", "c00", &kouho[0]);
|
||||
checkstr(t, "last capped candidate", "c31", &kouho[31]);
|
||||
snprint(item, sizeof item, "c%02d", Maxkouho-1);
|
||||
checkstr(t, "last capped candidate", item, &kouho[Maxkouho-1]);
|
||||
}
|
||||
CT_EQ_INT(t, 3, dictlookup(lang, &key, kouho, 3));
|
||||
trieclose(lang->dict);
|
||||
|
||||
@@ -128,12 +128,12 @@ class MkhanjaTest(unittest.TestCase):
|
||||
self.assertIn("한\t", result.stdout)
|
||||
|
||||
def test_generator_keeps_runtime_candidate_limit(self):
|
||||
rows = "".join(f"{chr(0x4E00 + n)}\t한\n" for n in range(33))
|
||||
rows = "".join(f"{chr(0x4E00 + n)}\t한\n" for n in range(129))
|
||||
result = run(GENERATE, self.source(rows))
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
candidates = result.stdout.rstrip().split("\t", 1)[1].split()
|
||||
self.assertEqual(len(candidates), 32)
|
||||
self.assertEqual(candidates[-1], chr(0x4E00 + 31))
|
||||
self.assertEqual(len(candidates), 128)
|
||||
self.assertEqual(candidates[-1], chr(0x4E00 + 127))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user