int srec_get_top_choice_transcription(multi_srec* recm, char *transcription, int len, int whether_strip_slot_markers)
{
  int rc;
  srec* rec = WHICH_RECOG(recm);
  frameID end_frame;
  srec_word_lattice* wl;
  wtokenID token_index;

  if (!rec)
  {
    *transcription = 0;
    return 1;
  }
  if( recm->eos_status == VALID_SPEECH_NOT_YET_DETECTED)
  {
      *transcription = 0;
      return 1;
  }

  end_frame = rec->current_search_frame;
  wl = rec->word_lattice;
  sort_word_lattice_at_frame(rec, end_frame);
  token_index = wl->words_for_frame[end_frame];

  if (token_index != MAXwtokenID)
  {
#if PRINT_WORD_LATTICE
    print_word_token_list(rec, token_index, "WORD TOKENS AT END\n");
#endif
    /* the head of the list on the last frame is always best */
    rc = sprint_word_token_backtrace(transcription, len, rec, token_index);
  }
  else
  {
    strcpy(transcription, "");
    rc = 1;
  }
  if (whether_strip_slot_markers)
    srec_result_strip_slot_markers(transcription);
  return rc;
}
示例#2
0
ESR_ReturnCode CA_ResultStripSlotMarkers(char *text)
{
  srec_result_strip_slot_markers(text);
  return ESR_SUCCESS;
}