예제 #1
0
파일: tree.c 프로젝트: chiehwen/libchewing
int Phrasing( ChewingData *pgdata )
{
	TreeDataType treeData;

	InitPhrasing( &treeData );

	FindInterval( pgdata, &treeData );
	SetInfo( pgdata->nPhoneSeq, &treeData );
	Discard1( &treeData );
	Discard2( &treeData );
	SaveList( &treeData );
	CountMatchCnnct( &treeData, pgdata->bUserArrCnnct, pgdata->nPhoneSeq );
	SortListByScore( &treeData );
	NextCut( &treeData, &pgdata->phrOut );

#ifdef ENABLE_DEBUG
	ShowList( &treeData );
	DEBUG_FLUSH;
#endif

	/* set phrasing output */
	OutputRecordStr(
		pgdata,
		pgdata->phrOut.chiBuf, sizeof(pgdata->phrOut.chiBuf),
		( treeData.phList )->arrIndex, 
		( treeData.phList )->nInter, 
		pgdata->phoneSeq,
		pgdata->nPhoneSeq,
		pgdata->selectStr, pgdata->selectInterval, pgdata->nSelect, &treeData );
	SaveDispInterval( &pgdata->phrOut, &treeData );

	/* free "phrase" */
	CleanUpMem( &treeData );
	return 0;
}
예제 #2
0
파일: tree.c 프로젝트: kanru/libchewing
int Phrasing(
		ChewingData *pgdata, /* FIXME: Remove other parameters since they are all in pgdata. */
		PhrasingOutput *ppo, uint16_t phoneSeq[], int nPhoneSeq,
		char selectStr[][ MAX_PHONE_SEQ_LEN * MAX_UTF8_SIZE + 1 ], 
		IntervalType selectInterval[], int nSelect, 
		int bArrBrkpt[], int bUserArrCnnct[] ) 
{
	TreeDataType treeData;

	InitPhrasing( &treeData );

	FindInterval( 
		pgdata,
		phoneSeq, nPhoneSeq, selectStr, selectInterval, nSelect, 
		bArrBrkpt, &treeData );
	SetInfo( nPhoneSeq, &treeData );
	Discard1( &treeData );
	Discard2( &treeData );
	SaveList( &treeData );
	CountMatchCnnct( &treeData, bUserArrCnnct, nPhoneSeq );
	SortListByScore( &treeData );
	NextCut( &treeData, ppo );

#ifdef ENABLE_DEBUG
	ShowList( &treeData );
	DEBUG_FLUSH;
#endif

	/* set phrasing output */
	OutputRecordStr(
		pgdata,
		ppo->chiBuf, sizeof(ppo->chiBuf),
		( treeData.phList )->arrIndex, 
		( treeData.phList )->nInter, 
		phoneSeq, 
		nPhoneSeq, 
		selectStr, selectInterval, nSelect, &treeData );
	SaveDispInterval( ppo, &treeData );

	/* free "phrase" */
	CleanUpMem( &treeData );
	return 0;
}