Skip to content

Commit c612950

Browse files
authored
Backport changes from AppTek (#153)
1 parent 7706445 commit c612950

File tree

655 files changed

+12484
-3972
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

655 files changed

+12484
-3972
lines changed

src/Am/AcousticModel.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public:
6565

6666
public:
6767
AcousticModel(const Core::Configuration& c)
68-
: Core::Component(c), Mc::Component(c) {}
68+
: Core::Component(c),
69+
Mc::Component(c) {}
6970
virtual ~AcousticModel() {}
7071

7172
virtual void load(Mode mode = complete) = 0;

src/Am/AcousticModelAdaptor.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
using namespace Am;
1818

1919
MixtureSetAdaptor::MixtureSetAdaptor(const Core::Configuration& c, Core::Ref<AcousticModel> toAdapt)
20-
: Component(c), Precursor(c, toAdapt) {
20+
: Component(c),
21+
Precursor(c, toAdapt) {
2122
Core::Ref<Mm::MixtureSet> mixtureSet = Mm::Module::instance().readMixtureSet(select("mixture-set"));
2223
if (!mixtureSet || !setMixtureSet(mixtureSet))
2324
criticalError("failed to initialize mixture set.");

src/Am/AcousticModelAdaptor.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ protected:
2929

3030
public:
3131
AcousticModelAdaptor(const Core::Configuration& c, Core::Ref<AcousticModel> toAdapt)
32-
: Component(c), toAdapt_(toAdapt) {
32+
: Component(c),
33+
toAdapt_(toAdapt) {
3334
require(toAdapt_);
3435
}
3536
virtual ~AcousticModelAdaptor() {}

src/Am/ClassicAcousticModel.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ bool ClassicAcousticModel::loadTransitionModel() {
168168
transitionModel_->setParentScale(scale());
169169
return true;
170170
}
171+
171172
return false;
172173
}
173174

src/Am/ClassicAcousticModel.hh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,20 @@ public:
136136
return (*transitionModel_)[i];
137137
}
138138
virtual StateTransitionIndex stateTransitionIndex(AllophoneState phone, s8 subState = 0) const {
139-
if (allophoneStateAlphabet()->isSilence(phone))
139+
if (allophoneStateAlphabet()->isSilence(phone)) {
140140
return TransitionModel::silence;
141-
else
141+
}
142+
else {
142143
return transitionModel_->classify(phone, subState);
144+
}
143145
}
144146
virtual StateTransitionIndex stateTransitionIndex(AllophoneStateIndex e, s8 subState = 0) const {
145-
if (silenceAllophoneStateIndex_ != Fsa::InvalidLabelId and e == silenceAllophoneStateIndex_)
147+
if (silenceAllophoneStateIndex_ != Fsa::InvalidLabelId and e == silenceAllophoneStateIndex_) {
146148
return TransitionModel::silence;
147-
else
149+
}
150+
else {
148151
return transitionModel_->classifyIndex(e, subState);
152+
}
149153
}
150154

151155
virtual const ClassicHmmTopology* hmmTopology(Bliss::Phoneme::Id phoneme) const {

src/Am/ClassicHmmTopologySet.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class ClassicHmmTopology {
3030

3131
public:
3232
ClassicHmmTopology(int nPhoneStates, int nSubStates)
33-
: nPhoneStates_(nPhoneStates), nSubStates_(nSubStates) {}
33+
: nPhoneStates_(nPhoneStates),
34+
nSubStates_(nSubStates) {}
3435
int nPhoneStates() const {
3536
return nPhoneStates_;
3637
}

src/Am/ClassicStateModel.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,9 @@ std::string AllophoneAlphabet::symbol(Fsa::LabelId id) const {
531531

532532
Fsa::LabelId AllophoneAlphabet::index(const std::string& symbol) const {
533533
Fsa::LabelId lid = specialIndex(symbol);
534-
if (lid == Fsa::InvalidLabelId)
534+
if (lid == Fsa::InvalidLabelId) {
535535
lid = index(fromString(symbol));
536+
}
536537
return lid;
537538
}
538539

@@ -798,7 +799,8 @@ struct IndexedAllophoneState {
798799
Am::AllophoneState allophoneState;
799800
IndexedAllophoneState() {}
800801
IndexedAllophoneState(Fsa::LabelId id, Am::AllophoneState allophoneState)
801-
: id(id), allophoneState(allophoneState) {}
802+
: id(id),
803+
allophoneState(allophoneState) {}
802804
bool operator<(const IndexedAllophoneState& i) const {
803805
return id < i.id;
804806
}

src/Am/ClassicStateModel.hh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,20 @@ struct Allophone : public Phonology::Allophone {
5656
Allophone()
5757
: Precursor() {}
5858
Allophone(Bliss::Phoneme::Id phoneme, s16 b)
59-
: Precursor(phoneme), boundary(b) {}
59+
: Precursor(phoneme),
60+
boundary(b) {}
6061
Allophone(const Phonology::Allophone& a, s16 b)
61-
: Precursor(a), boundary(b) {}
62+
: Precursor(a),
63+
boundary(b) {}
6264

6365
bool operator==(const Allophone& allo) const {
6466
return (boundary == allo.boundary) && Precursor::operator==(allo);
6567
}
6668

6769
struct Hash {
6870
Phonology::Allophone::Hash ah;
69-
u32 operator()(const Allophone& a) const {
71+
72+
u32 operator()(const Allophone& a) const {
7073
return ah(a) ^ (u32(a.boundary) << 13);
7174
}
7275
};
@@ -103,7 +106,8 @@ public:
103106
private:
104107
struct AllophonePtrHash {
105108
Allophone::Hash h;
106-
size_t operator()(const Allophone* const a) const {
109+
110+
size_t operator()(const Allophone* const a) const {
107111
return h(*a);
108112
}
109113
};
@@ -228,11 +232,13 @@ private:
228232

229233
private:
230234
AllophoneState(const Allophone* allo, s16 state)
231-
: allo_(allo), state_(state) {}
235+
: allo_(allo),
236+
state_(state) {}
232237

233238
public:
234239
AllophoneState()
235-
: allo_(0), state_(0) {}
240+
: allo_(0),
241+
state_(0) {}
236242

237243
operator const Allophone*() const {
238244
require(allo_);
@@ -258,13 +264,15 @@ public:
258264
require(allo_);
259265
return allo_;
260266
}
267+
261268
s16 state() const {
262269
return state_;
263270
}
264271

265272
struct Hash {
266273
Allophone::Hash ah;
267-
u32 operator()(const AllophoneState& alloState) const {
274+
275+
u32 operator()(const AllophoneState& alloState) const {
268276
return ah(alloState) ^ (u32(alloState.state()) << 21);
269277
}
270278
};

src/Am/ClassicStateTying.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ private:
3838

3939
public:
4040
EmissionAlphabet(Mm::MixtureIndex nMixtures = 0)
41-
: nMixtures_(nMixtures), nDisambiguators_(0) {}
41+
: nMixtures_(nMixtures),
42+
nDisambiguators_(0) {}
4243
Mm::MixtureIndex nMixtures() const {
4344
return nMixtures_;
4445
}

src/Am/ClassicTransducerBuilder.cc

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class ClassicTransducerBuilder::Statistics {
3131
bool isCoarticulated;
3232
PhoneBoundaryStateSetDescriptor(
3333
const PhoneBoundaryStateDescriptor& pbsd)
34-
: phoneBoundaryFlag(pbsd.flag), isCoarticulated(pbsd.isCoarticulated()) {
34+
: phoneBoundaryFlag(pbsd.flag),
35+
isCoarticulated(pbsd.isCoarticulated()) {
3536
}
3637

3738
Core::XmlOpen xmlAttributes(const Core::XmlOpen&) const;
@@ -140,7 +141,10 @@ static const Core::ParameterBool paramFixAllophoneContextAtWordBoundaries(
140141
ClassicTransducerBuilder::ClassicTransducerBuilder(Core::Ref<
141142
const ClassicAcousticModel>
142143
model)
143-
: TransducerBuilder(), model_(model), silencesAndNoises_(0), allophoneSuffixes_(2500, AllophoneSuffix::Hash(this), AllophoneSuffix::Equality(this)) {
144+
: TransducerBuilder(),
145+
model_(model),
146+
silencesAndNoises_(0),
147+
allophoneSuffixes_(2500, AllophoneSuffix::Hash(this), AllophoneSuffix::Equality(this)) {
144148
require(model);
145149
allophones_ = model_->allophoneAlphabet();
146150
allophoneList_ = &model_->allophoneAlphabet()->allophones();
@@ -649,8 +653,7 @@ Fsa::ConstAutomatonRef ClassicTransducerBuilder::applyTransitionModel(
649653

650654
const Allophone* silenceAllophone = allophones_->allophone(Allophone(
651655
Phonology::Allophone(model_->silence_), Allophone::isInitialPhone | Allophone::isFinalPhone));
652-
AllophoneState silenceState = allophoneStates_->allophoneState(
653-
silenceAllophone, 0);
656+
AllophoneState silenceState = allophoneStates_->allophoneState(silenceAllophone, 0);
654657

655658
Fsa::LabelId silenceLabel = Fsa::InvalidLabelId;
656659
if (ff->inputAlphabet() == allophoneStates_)
@@ -921,15 +924,21 @@ struct PhoneContext : public Phones {
921924
bool boundary_;
922925
Fsa::LabelId disambiguator_;
923926
PhoneContext(size_t n, bool boundary = false, Fsa::LabelId disambiguator = Fsa::Epsilon)
924-
: Phones(n, Bliss::Phoneme::term), boundary_(boundary), disambiguator_(disambiguator) {
927+
: Phones(n, Bliss::Phoneme::term),
928+
boundary_(boundary),
929+
disambiguator_(disambiguator) {
925930
}
926931
PhoneContext(const Phones& phones, bool boundary = false,
927932
Fsa::LabelId disambiguator = Fsa::Epsilon)
928-
: Phones(phones), boundary_(boundary), disambiguator_(disambiguator) {
933+
: Phones(phones),
934+
boundary_(boundary),
935+
disambiguator_(disambiguator) {
929936
}
930937
PhoneContext(Phones::const_iterator pBegin, Phones::const_iterator pEnd,
931938
bool boundary = false, Fsa::LabelId disambiguator = Fsa::Epsilon)
932-
: Phones(pBegin, pEnd), boundary_(boundary), disambiguator_(disambiguator) {
939+
: Phones(pBegin, pEnd),
940+
boundary_(boundary),
941+
disambiguator_(disambiguator) {
933942
}
934943
};
935944

@@ -949,7 +958,9 @@ struct NoCoartBoundary {
949958
Fsa::LabelId input_, phoneDisambiguator_;
950959
NoCoartBoundary(Fsa::State* state, Fsa::LabelId input,
951960
Fsa::LabelId phoneDisambiguator)
952-
: state_(state), input_(input), phoneDisambiguator_(phoneDisambiguator) {
961+
: state_(state),
962+
input_(input),
963+
phoneDisambiguator_(phoneDisambiguator) {
953964
}
954965
};
955966

@@ -1005,10 +1016,10 @@ Fsa::ConstAutomatonRef ClassicTransducerBuilder::createMinimizedContextDependenc
10051016

10061017
Fsa::Hash<PhoneContext, PhoneContextHash> stateMap;
10071018
PhoneContext pc(maxHistory + maxFuture, true);
1008-
Fsa::State* initial = new Fsa::State(stateMap.insert(pc),
1009-
model_->isAcrossWordModelEnabled() ? Fsa::StateTagFinal
1010-
: Fsa::StateTagNone,
1011-
semiring->one());
1019+
1020+
Fsa::State* initial = new Fsa::State(stateMap.insert(pc),
1021+
model_->isAcrossWordModelEnabled() ? Fsa::StateTagFinal : Fsa::StateTagNone,
1022+
semiring->one());
10121023
_c->setState(initial);
10131024
_c->setInitialStateId(initial->id());
10141025
if (model_->isAcrossWordModelEnabled()) {

0 commit comments

Comments
 (0)