Skip to content

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
KarelVesely84 committed Feb 14, 2024
1 parent 5190e9b commit f8d2abd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sherpa-onnx/csrc/hypothesis.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ struct Hypothesis {

// The acoustic probability for each token in ys.
// Used for keyword spotting task.
// For transducer mofified beam-search, this is filled with log_posterior scores.
// For transducer mofified beam-search and greedy-search,
// this is filled with log_posterior scores.
std::vector<float> ys_probs;

// lm_probs[i] contains the lm score for each token in ys.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ void OnlineTransducerModifiedBeamSearchDecoder::StripLeadingBlanks(
r->tokens = std::move(tokens);
r->timestamps = std::move(hyp.timestamps);


// export per-token scores
r->ys_probs = std::move(hyp.ys_probs);
r->lm_probs = std::move(hyp.lm_probs);
Expand Down
3 changes: 3 additions & 0 deletions sherpa-onnx/python/sherpa_onnx/online_recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ def is_ready(self, s: OnlineStream) -> bool:
def get_result(self, s: OnlineStream) -> str:
return self.recognizer.get_result(s).text.strip()

def get_result_as_json_string(self, s: OnlineStream) -> str:
return self.recognizer.get_result(s).as_json_string()

def tokens(self, s: OnlineStream) -> List[str]:
return self.recognizer.get_result(s).tokens

Expand Down

0 comments on commit f8d2abd

Please sign in to comment.