void makeDFA( void ) { if( !SW_Quiet ){ fprintf( stderr, "Now making deterministic finite automaton" ); NoNewLine = 1; } r_makeDFA( FAlist ); if( !SW_Quiet ){ fprintf( stderr, "\rNow making deterministic finite automaton[%d/%d] \n", FAprocessed, FAtotal ); if( FAtotal != FAprocessed ){ fprintf( stderr, "* %d released FA nodes are left on isolated loop\n", FAtotal - FAprocessed ); } NoNewLine = 0; } /* 何かバグがあったとき恐いが孤立ループのチェックが 不可能なのでしょうがない */ FAtotal = FAprocessed; if( SW_Verbose ){ verboseMes( "** traversing efficiency ( success/total )" ); verboseMes( "r_makeDFA: %d/%d(%d%%)", DFAtravSuccess, DFAtravTotal, 100*DFAtravSuccess/DFAtravTotal); } newLineAdjust(); freeFAlist( GroupList ); }
void makeTriplet( void ) { FILE *fp_fa; FA *fa; FAprocessed = 0; if( (fp_fa = fopen( FAfile, "w" )) == NULL ){ errMes( "Can't open dfa File for writting\"%s\"", FAfile ); } getNewStatNo( FAlist ); if( !SW_Quiet ){ fprintf( stderr, "Now making triplet list" ); NoNewLine = 1; } while( 1 ){ if( (fa = processTripletQueue( NULL )) == NULL ) break; r_makeTriplet( fa, fp_fa ); } fclose( fp_fa ); if( !SW_Quiet ){ fprintf( stderr, "\rNow making triplet list[%d/%d]\n", FAprocessed, FAtotal ); NoNewLine = 0; } if( SW_Verbose ){ verboseMes( "r_makeTriplet: %d/%d(%d%%)", TFAtravSuccess, TFAtravTotal, 100*TFAtravSuccess/TFAtravTotal); } newLineAdjust(); }
void setVoca( void ) { char token1[ SYMBOL_LEN ]; char token2[ SYMBOL_LEN ]; int virgin = 1; int bodynum = 0; BODY *bodyList = NULL; FILE *fp; char identifier[ SYMBOL_LEN ] = ""; if( (fp = fopen( VocaFile, "r" )) == NULL ){ errMes( "Can't open vocabulary file\"%s\"", VocaFile ); } if( !SW_Quiet ){ newLineAdjust(); fputs( "Now parsing vocabulary file\n", stderr ); } while( 1 ){ static char line[ 1000 ]; char *ptr = line; if( fgets( line, 1000, fp ) == NULL ){ entryTerm( identifier, bodyList, bodynum ); break; } if( line[ 0 ] == '\0' ) continue; if( line[ 0 ] == '#' ){ if( (ptr = gettoken( ptr, token1 )) == NULL ) continue; if( !virgin ){ entryTerm( identifier, bodyList, bodynum ); bodyList = NULL; bodynum = 0; } else { virgin = 0; } strcpy( identifier, token1 + 1 ); continue; } else { ptr = gettoken( ptr, token1 ); if( ptr == NULL ) continue; ptr = gettoken( ptr, token2 ); if( ptr == NULL ){ bodyList = appendTerm( bodyList, token1 ); } else { bodyList = appendTerm( bodyList, token2 ); } bodynum++; } } }