@@ -22,47 +22,31 @@ namespace Nn {
2222TransitionLabelScorer::TransitionLabelScorer (Core::Configuration const & config)
2323 : Core::Component(config),
2424 Precursor (config, TransitionPresetType::ALL),
25- transitionScores_(),
26- baseLabelScorer_(Nn::Module::instance().labelScorerFactory().createLabelScorer(select(" base-scorer" ))) {
25+ transitionScores_() {
2726 for (auto const & [stringIdentifier, enumValue] : transitionTypeArray_) {
2827 auto paramName = std::string (stringIdentifier) + " -score" ;
2928 transitionScores_[enumValue] = Core::ParameterFloat (paramName.c_str (), " " , 0.0 )(config);
3029 }
3130}
3231
33- void TransitionLabelScorer::reset () {
34- baseLabelScorer_->reset ();
35- }
32+ void TransitionLabelScorer::reset () {}
3633
37- void TransitionLabelScorer::signalNoMoreFeatures () {
38- baseLabelScorer_->signalNoMoreFeatures ();
39- }
34+ void TransitionLabelScorer::signalNoMoreFeatures () {}
4035
4136ScoringContextRef TransitionLabelScorer::getInitialScoringContext () {
42- return baseLabelScorer_->getInitialScoringContext ();
43- }
44-
45- void TransitionLabelScorer::cleanupCaches (Core::CollapsedVector<ScoringContextRef> const & activeContexts) {
46- baseLabelScorer_->cleanupCaches (activeContexts);
37+ return Core::ref (new ScoringContext ());
4738}
4839
49- void TransitionLabelScorer::addInput (DataView const & input) {
50- baseLabelScorer_->addInput (input);
51- }
52-
53- void TransitionLabelScorer::addInputs (DataView const & input, size_t nTimesteps) {
54- baseLabelScorer_->addInputs (input, nTimesteps);
55- }
40+ void TransitionLabelScorer::addInput (DataView const & input) {}
5641
5742ScoringContextRef TransitionLabelScorer::extendedScoringContextInternal (LabelScorer::Request const & request) {
58- return baseLabelScorer_-> extendedScoringContext (request );
43+ return Core::ref ( new ScoringContext () );
5944}
6045
6146std::optional<LabelScorer::ScoreWithTime> TransitionLabelScorer::computeScoreWithTimeInternal (LabelScorer::Request const & request) {
62- auto result = baseLabelScorer_->computeScoreWithTime (request);
63- if (result) {
64- result->score += transitionScores_[request.transitionType ];
65- }
47+ LabelScorer::ScoreWithTime result;
48+ result.score = transitionScores_[request.transitionType ];
49+ result.timeframe = static_cast <Speech::TimeframeIndex>(0 );
6650 return result;
6751}
6852
@@ -71,11 +55,10 @@ std::optional<LabelScorer::ScoresWithTimes> TransitionLabelScorer::computeScores
7155 return ScoresWithTimes{};
7256 }
7357
74- auto results = baseLabelScorer_->computeScoresWithTimes (requests);
75- if (results) {
76- for (size_t i = 0ul ; i < requests.size (); ++i) {
77- results->scores [i] += transitionScores_[requests[i].transitionType ];
78- }
58+ LabelScorer::ScoresWithTimes results;
59+ for (size_t i = 0ul ; i < requests.size (); ++i) {
60+ results.scores .push_back (transitionScores_[requests[i].transitionType ]);
61+ results.timeframes .push_back (static_cast <Speech::TimeframeIndex>(0 ));
7962 }
8063 return results;
8164}
0 commit comments