8000 Update documentation and structure in Speech::ModelCombination by larissakl · Pull Request #133 · rwth-i6/rasr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert

Update documentation and structure in Speech::ModelCombination #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Speech/ModelCombination.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ ModelCombination::ModelCombination(const Core::Configuration& c,
Bliss::LexiconRef lexicon,
Core::Ref<Am::AcousticModel> acousticModel,
Core::Ref<Lm::ScaledLanguageModel> languageModel)
: Core::Component(c), Mc::Component(c), pronunciationScale_(0) {
: Core::Component(c),
Mc::Component(c),
pronunciationScale_(0) {
setPronunciationScale(paramPronunciationScale(c));
setLexicon(lexicon);
setAcousticModel(acousticModel);
Expand Down
43 changes: 25 additions & 18 deletions src/Speech/ModelCombination.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@

namespace Speech {

/** Combination of a lexicon, an acoustic model or label scorer, and a language model.
* It supports creation and initialization of these three mutually dependent objects.
/** Combination of a lexicon, an acoustic model, a label scorer and a language model.
* It supports the creation and initialization of these four mutually dependent objects.
*
* Usage:
* 1) create ModelCombination object locally to create the three parts:
* lexicon, acoustic model, and language model.Store references of those parts which you
* 2) call function load, to load the scaling values
* 3) Store the references to those parts you will use later.
* 4) When the local ModelCombination object get destructed, the unreferenced parts gets freed as well.
* - Create a ModelCombination object locally to create the four parts:
* lexicon, acoustic model, label scorer and/or language model.
* - The ModelCombination can be directly created by passing references to the lexicon,
* acoustic model and language model.
* - Alternatively, it is possible to set a Mode indicating which components are required
* by setting useLexicon, useAcousticModel, useLanguageModel and/or useLabelScorer.
* In this case, the ModelCombination will create the relevant parts from the config.
* (A Mode for the acoustic model and a lexicon reference can optionally be passed as well.)
* - Store the references to those parts which you will use later.
* - When the local ModelCombination object is destructed, the unreferenced parts get freed as well.
*/
class ModelCombination : public Mc::Component, public Core::ReferenceCounted {
public:
Expand Down Expand Up @@ -66,41 +71,43 @@ public:
Mode = complete,
Am::AcousticModel::Mode = Am::AcousticModel::complete,
Bliss::LexiconRef = Bliss::LexiconRef());

ModelCombination(const Core::Configuration&,
Bliss::LexiconRef, Core::Ref<Am::AcousticModel>, Core::Ref<Lm::ScaledLanguageModel>);
Bliss::LexiconRef,
Core::Ref<Am::AcousticModel>,
Core::Ref<Lm::ScaledLanguageModel>);

virtual ~ModelCombination();

void build(Mode = complete, Am::AcousticModel::Mode = Am::AcousticModel::complete, Bliss::LexiconRef = Bliss::LexiconRef());
Mm::Score pronunciationScale() const {
return pronunciationScale_ * scale();
}

void getDependencies(Core::DependencySet&) const;
void setLexicon(Bliss::LexiconRef);

Bliss::LexiconRef lexicon() const {
return lexicon_;
}

void setLexicon(Bliss::LexiconRef);

Mm::Score pronunciationScale() const {
return pronunciationScale_ * scale();
}
void setAcousticModel(Core::Ref<Am::AcousticModel>);

Core::Ref<Am::AcousticModel> acousticModel() const {
return acousticModel_;
}

void setAcousticModel(Core::Ref<Am::AcousticModel>);
void setLanguageModel(Core::Ref<Lm::ScaledLanguageModel>);

Core::Ref<Lm::ScaledLanguageModel> languageModel() const {
return languageModel_;
}

void setLanguageModel(Core::Ref<Lm::ScaledLanguageModel>);

void setLabelScorer(Core::Ref<Nn::LabelScorer> ls);

Core::Ref<Nn::LabelScorer> labelScorer() const {
return labelScorer_;
}

void getDependencies(Core::DependencySet&) const;
};

typedef Core::Ref<ModelCombination> ModelCombinationRef;
Expand Down
0