@@ -361,10 +361,13 @@ void Dict::End() {
361
361
// according to at least one of the dawgs in the dawgs_ vector.
362
362
// See more extensive comments in dict.h where this function is declared.
363
363
int Dict::def_letter_is_okay (void * void_dawg_args,
364
+ const UNICHARSET& unicharset,
364
365
UNICHAR_ID unichar_id,
365
366
bool word_end) const {
366
367
DawgArgs *dawg_args = static_cast <DawgArgs *>(void_dawg_args);
367
368
369
+ ASSERT_HOST (unicharset.contains_unichar_id (unichar_id));
370
+
368
371
if (dawg_debug_level >= 3 ) {
369
372
tprintf (" def_letter_is_okay: current unichar=%s word_end=%d"
370
373
" num active dawgs=%d\n " ,
@@ -410,7 +413,7 @@ int Dict::def_letter_is_okay(void* void_dawg_args,
410
413
for (int s = 0 ; s < slist.length (); ++s) {
411
414
int sdawg_index = slist[s];
412
415
const Dawg *sdawg = dawgs_[sdawg_index];
413
- UNICHAR_ID ch = char_for_dawg (unichar_id, sdawg);
416
+ UNICHAR_ID ch = char_for_dawg (unicharset, unichar_id, sdawg);
414
417
EDGE_REF dawg_edge = sdawg->edge_char_of (0 , ch, word_end);
415
418
if (dawg_edge != NO_EDGE) {
416
419
if (dawg_debug_level >=3 ) {
@@ -477,7 +480,8 @@ int Dict::def_letter_is_okay(void* void_dawg_args,
477
480
// Find the edge out of the node for the unichar_id.
478
481
NODE_REF node = GetStartingNode (dawg, pos.dawg_ref );
479
482
EDGE_REF edge = (node == NO_EDGE) ? NO_EDGE
480
- : dawg->edge_char_of (node, char_for_dawg (unichar_id, dawg), word_end);
483
+ : dawg->edge_char_of (node, char_for_dawg (unicharset, unichar_id, dawg),
484
+ word_end);
481
485
482
486
if (dawg_debug_level >= 3 ) {
483
487
tprintf (" Active dawg: [%d, " REFFORMAT " ] edge=" REFFORMAT " \n " ,
@@ -759,7 +763,8 @@ int Dict::valid_word(const WERD_CHOICE &word, bool numbers_ok) const {
759
763
int last_index = word_ptr->length () - 1 ;
760
764
// Call letter_is_okay for each letter in the word.
761
765
for (int i = hyphen_base_size (); i <= last_index; ++i) {
762
- if (!((this ->*letter_is_okay_)(&dawg_args, word_ptr->unichar_id (i),
766
+ if (!((this ->*letter_is_okay_)(&dawg_args, *word_ptr->unicharset (),
767
+ word_ptr->unichar_id (i),
763
768
i == last_index))) break ;
764
769
// Swap active_dawgs, constraints with the corresponding updated vector.
765
770
if (dawg_args.updated_dawgs == &(active_dawgs[1 ])) {
0 commit comments