コード例 #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
ファイル: list.cpp プロジェクト: Hydro8182/taiga
int SortList(int type, int order, int id1, int id2) {
  auto item1 = AnimeDatabase.FindItem(id1);
  auto item2 = AnimeDatabase.FindItem(id2);

  if (item1 && item2) {
    switch (type) {
      case kListSortDateStart:
        return SortListByDateStart(*item1, *item2);
      case kListSortEpisodeCount:
        return SortListByEpisodeCount(*item1, *item2);
      case kListSortLastUpdated:
        return SortListByLastUpdated(*item1, *item2);
      case kListSortPopularity:
        return SortListByPopularity(*item1, *item2);
      case kListSortProgress:
        return SortListByProgress(*item1, *item2);
      case kListSortMyScore:
        return SortListByMyScore(*item1, *item2);
      case kListSortScore:
        return SortListByScore(*item1, *item2);
      case kListSortSeason:
        return SortListBySeason(*item1, *item2, order);
      case kListSortStatus:
        return SortListByAiringStatus(*item1, *item2);
      case kListSortTitle:
        return SortListByTitle(*item1, *item2);
    }
  }

  return base::kEqualTo;
}
コード例 #3
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;
}