00001 #include <iostream>
00002 using std::cin;
00003 using std::cout;
00004
00005
00012
00013
00016
00021 typedef TransducerHandle TransducerHandle;
00022
00024
00025
00026
00031
00032
00037 TransducerHandle create_empty_transducer();
00038
00039
00044 TransducerHandle create_epsilon_transducer();
00045
00046
00050 TransducerHandle define_transducer( Key k );
00051
00052
00056 TransducerHandle define_transducer( KeyPair *p );
00057
00058
00063 TransducerHandle define_transducer( KeySet *ks );
00064
00065
00070 TransducerHandle define_transducer( KeyPairSet *Pi );
00071
00072
00078 KeyPairSet *define_keypair_set( TransducerHandle t );
00079
00080
00085 KeySet *define_key_set( TransducerHandle t );
00086
00087
00094 TransducerHandle add_weight( TransducerHandle t, float w );
00095
00096
00099 void delete_transducer( TransducerHandle t );
00100
00102
00103
00104
00118
00120
00121
00122
00127
00128
00140 TransducerHandle compose( TransducerHandle t1, TransducerHandle t2, bool destructive=true );
00141
00142
00151 TransducerHandle concatenate( TransducerHandle t1, TransducerHandle t2 );
00152
00153
00158 TransducerHandle copy(TransducerHandle t);
00159
00160
00167 TransducerHandle disjunct( TransducerHandle t1, TransducerHandle t2 );
00168
00169
00172 TransducerHandle disjunct_transducers_as_tries( TransducerHandle t1, TransducerHandle t2 );
00173
00182 TransducerHandle disjunct_as_trie( TransducerHandle t, KeyVector * key_string, float weight=0, bool sum_weights=false );
00183
00188 TransducerHandle disjunct_as_trie( TransducerHandle t,
00189 KeyPairVector * key_pair_string, float weight=0, bool sum_weights=false );
00190
00199 TransducerHandle extract_input_language( TransducerHandle t );
00200
00201
00210 TransducerHandle extract_output_language( TransducerHandle t );
00211
00212
00224 TransducerHandle intersect( TransducerHandle t1, TransducerHandle t2 );
00225
00226
00240 TransducerHandle intersecting_composition( TransducerHandle t, vector<TransducerHandle> * v, KeyTable * kt=NULL);
00241
00249 TransducerHandle invert( TransducerHandle t );
00250
00251
00266 TransducerHandle negate( TransducerHandle t, KeyPairSet *Pi );
00267
00268
00273 TransducerHandle optionalize( TransducerHandle t );
00274
00275
00278 TransducerHandle repeat_le_n( TransducerHandle t, int n );
00279
00280
00288 TransducerHandle repeat_n( TransducerHandle t, int n );
00289
00290
00297 TransducerHandle repeat_plus( TransducerHandle t );
00298
00299
00306 TransducerHandle repeat_star( TransducerHandle t );
00307
00308
00311 TransducerHandle reverse( TransducerHandle t );
00312
00313
00325 TransducerHandle subtract( TransducerHandle t1, TransducerHandle t2 );
00326
00327
00329
00330
00331
00332
00337
00344 TransducerHandle add_input_language( TransducerHandle t, KeyPairSet *Pi );
00345
00352 TransducerHandle add_output_language( TransducerHandle t, KeyPairSet *Pi );
00353
00362 TransducerHandle insert_freely( TransducerHandle t, KeyPair *p );
00363
00365 TransducerHandle remove_pair (TransducerHandle t, KeyPair *p);
00366
00368 TransducerHandle remove_pairs (TransducerHandle t, KeySet *ks);
00369
00373 TransducerHandle shuffle( TransducerHandle t1, TransducerHandle t2 );
00374
00382 TransducerHandle substitute_key( TransducerHandle t, Key k1, Key k2, bool ignore_epsilon_pairs=false );
00383
00385 TransducerHandle substitute_key( TransducerHandle t, KeySet *ks, Key k2 );
00386
00388 TransducerHandle substitute_with_pair ( TransducerHandle t, KeyPair *p1, KeyPair *p2);
00389
00391 TransducerHandle substitute_with_transducer ( TransducerHandle t, KeyPair *p, TransducerHandle tr);
00392
00394
00395
00396
00397
00398
00399
00400
00405
00406
00415 TransducerHandle determinize( TransducerHandle t );
00416
00417
00424 vector<TransducerHandle> find_all_paths( TransducerHandle t, bool unique=false );
00425
00426
00438 TransducerHandle find_best_paths(TransducerHandle t, int n, bool unique=false);
00439
00440
00451 TransducerHandle find_random_paths(TransducerHandle t, int max_number, bool unique=false);
00452
00453
00461 TransducerHandle minimize( TransducerHandle t );
00462
00463
00468 TransducerHandle push_weights( TransducerHandle t, bool initial );
00469
00470
00471
00474 TransducerHandle modify_weights( TransducerHandle t, float(*modify)(float), bool modify_transition_weights=false );
00475
00476
00481 TransducerHandle remove_epsilons( TransducerHandle t );
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00505
00506
00507
00508
00514
00515
00525 bool are_equivalent(TransducerHandle t1, TransducerHandle t2);
00526
00527
00533 bool are_disjoint( TransducerHandle t1, TransducerHandle t2 );
00534
00535
00544 float get_weight(TransducerHandle t);
00545
00546
00551 bool is_automaton(TransducerHandle t);
00552
00553
00558 bool is_cyclic(TransducerHandle t);
00559
00560
00568 bool is_infinitely_ambiguous(TransducerHandle t, bool output=true, KeyVector *kv=NULL);
00569
00572 bool is_deterministic( TransducerHandle t );
00573
00574
00582 bool is_empty(TransducerHandle t);
00583
00584
00592 bool is_epsilon(TransducerHandle t);
00593
00594
00597 bool is_minimal( TransducerHandle t );
00598
00599
00602 bool is_subset( TransducerHandle t1, TransducerHandle t2 );
00603
00604
00607 KeyVectorVector * lookup_all(TransducerHandle t,
00608 vector<Key> * input_string );
00609
00614 KeyVector * lookup_first(TransducerHandle t,
00615 vector<Key> * input_string );
00616
00618
00619
00620
00621
00622
00623
00624
00625
00626
00634
00635
00644 int read_format( istream &is=cin );
00645
00647 TransducerHandle read_transducer( istream &is=cin );
00648
00650 TransducerHandle read_transducer( const char *filename );
00651
00654 TransducerHandle read_transducer_number(istream &is);
00655
00662 void write_transducer( TransducerHandle t, ostream &os=cout, bool backwards_compatibility=false );
00663
00667 void write_transducer( TransducerHandle t, const char *filename, bool backwards_compatibility=false );
00668
00669
00673 void print_transducer_number( TransducerHandle t, bool print_weights=true, ostream &os=cout );
00674
00676
00680 void display_symbols( TransducerHandle t);
00681 TransducerHandle read_runtime_transducer( FILE * f );
00682
00683
00684
00685