G2P: Removing duplicate phones
This commit is contained in:
parent
e415d59c16
commit
07fe549f42
|
@ -88,15 +88,20 @@ vector<Phone> wordToPhones(const std::string& word) {
|
||||||
} while (changed);
|
} while (changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove duplicate phones
|
||||||
vector<Phone> result;
|
vector<Phone> result;
|
||||||
|
Phone lastPhone = Phone::Noise;
|
||||||
for (wchar_t c : wideWord) {
|
for (wchar_t c : wideWord) {
|
||||||
Phone phone = charToPhone(c);
|
Phone phone = charToPhone(c);
|
||||||
if (phone == Phone::Noise) {
|
if (phone == Phone::Noise) {
|
||||||
logging::errorFormat("G2P error determining pronunciation for '{}': Character '{}' is not a recognized phone shorthand.",
|
logging::errorFormat("G2P error determining pronunciation for '{}': Character '{}' is not a recognized phone shorthand.",
|
||||||
word, static_cast<char>(c));
|
word, static_cast<char>(c));
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (phone != lastPhone) {
|
||||||
result.push_back(phone);
|
result.push_back(phone);
|
||||||
}
|
}
|
||||||
|
lastPhone = phone;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue