Lines Matching refs:ch_map
195 def pack(self, node_list, ch_map, use_node=False): argument
202 succ = sorted([ch_map[c] + edge_start for c in node.succ.keys()])
226 size += max(ch_map.values()) + 1
230 def bfs(self, ch_map): argument
238 assert ch_map[c] not in mapped, 'duplicate edge ' + node.str + ' ' + hex(ord(c))
239 mapped[ch_map[c]] = next
286 ch_map = {'.': 0}
300 ch_map[c] = i + 1
301 return ch_map
320 def generate_alphabet(ch_map): argument
321 ch_map = ch_map.copy()
322 del ch_map['.']
323 min_ch = ord(min(ch_map))
324 max_ch = ord(max(ch_map))
325 if max_ch - min_ch < 1024 and max(ch_map.values()) < 256:
328 for c, val in ch_map.items():
335 assert max(ch_map.values()) < 2048, 'max number of unique characters exceeded'
336 result = [struct.pack('<2I', 1, len(ch_map))]
337 for c, val in sorted(ch_map.items()):
347 def generate_trie(hyph, ch_map, n_trie, dedup_ix, dedup_nodes, patmap): argument
351 link_shift = num_bits(max(ch_map.values()))
362 c_num = ch_map[c]
410 def generate_hyb_file(hyph, ch_map, hyb_fn): argument
411 bfs = hyph.bfs(ch_map)
413 n_trie = hyph.pack(dedup_nodes, ch_map)
414 alphabet = generate_alphabet(ch_map)
416 trie = generate_trie(hyph, ch_map, n_trie, dedup_ix, dedup_nodes, patmap)
445 ch_map = {}
454 ch_map[val] = lowercase[0]
456 ch_map[0] = '.'
457 return (ch_map, result)
469 def traverse_trie(ix, s, trie_data, ch_map, pattern_data, patterns, exceptions): argument
502 for ch in ch_map:
506 sch = s + ch_map[ch]
507 traverse_trie(link, sch, trie_data, ch_map, pattern_data, patterns, exceptions)
541 ch_map, reconstructed_chr = map_to_chr(alphabet_map)
553 traverse_trie(0, '', trie_data, ch_map, pattern_data, patterns, exceptions)
578 ch_map = load_chr(chr_fn)
581 generate_hyb_file(hyph, ch_map, out_fn)