示例#1
0
/* Generates a file containing pairs of deligatured & "real" words,
   one pair per line.  This file can then be used to efficiently load
   the ligatures into memory via the load_ligatures() function.
   Allows ligature generation to be performed as one-time
   preprocessing step. */
int generate_ligatures( char *dictionary_file,
                        char *ligature_file ) {
  Trie *trie;
  if ( trie = find_ligatures( dictionary_file ) ) {
    FILE *ligatures_fp = fopen( ligature_file, "w" );
    if ( ligatures_fp ) {
      trie_iterate_dfs( trie, 
                        write_ligature_callback,
                        ligatures_fp );
    }
    fclose( ligatures_fp );
  }
  trie_free( trie, _free_ligature_data_callback2 );
}
示例#2
0
void trie_display( Trie *t ) {
  trie_iterate_dfs( t, trie_display_node, NULL );
}