Skip to content
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

[G2pPack + Phonetic Assistant] Give same phonetic result for uppercase and lowercase graphemes #1209

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion OpenUtau.Core/Api/G2pPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

protected Tuple<IG2p, InferenceSession> LoadPack(
byte[] data,
Func<string, string> prepGrapheme = null,

Check warning on line 22 in OpenUtau.Core/Api/G2pPack.cs

View workflow job for this annotation

GitHub Actions / pr-test (windows-latest, win-x64)

Cannot convert null literal to non-nullable reference type.

Check warning on line 22 in OpenUtau.Core/Api/G2pPack.cs

View workflow job for this annotation

GitHub Actions / pr-test (macos-13, osx-x64)

Cannot convert null literal to non-nullable reference type.

Check warning on line 22 in OpenUtau.Core/Api/G2pPack.cs

View workflow job for this annotation

GitHub Actions / pr-test (ubuntu-latest, linux-x64)

Cannot convert null literal to non-nullable reference type.
Func<string, string> prepPhoneme = null) {

Check warning on line 23 in OpenUtau.Core/Api/G2pPack.cs

View workflow job for this annotation

GitHub Actions / pr-test (windows-latest, win-x64)

Cannot convert null literal to non-nullable reference type.

Check warning on line 23 in OpenUtau.Core/Api/G2pPack.cs

View workflow job for this annotation

GitHub Actions / pr-test (macos-13, osx-x64)

Cannot convert null literal to non-nullable reference type.

Check warning on line 23 in OpenUtau.Core/Api/G2pPack.cs

View workflow job for this annotation

GitHub Actions / pr-test (ubuntu-latest, linux-x64)

Cannot convert null literal to non-nullable reference type.
prepGrapheme = prepGrapheme ?? ((string s) => s);
prepPhoneme = prepPhoneme ?? ((string s) => s);
string[] dictTxt = Zip.ExtractText(data, "dict.txt");
Expand Down Expand Up @@ -68,7 +68,7 @@
if (grapheme.Length == 0 || kAllPunct.IsMatch(grapheme)) {
return null;
}
var phonemes = Dict.Query(grapheme);
var phonemes = Dict.Query(grapheme.ToLowerInvariant());
if (phonemes == null && !PredCache.TryGetValue(grapheme, out phonemes)) {
phonemes = Predict(grapheme);
if (phonemes.Length == 0) {
Expand Down
2 changes: 1 addition & 1 deletion OpenUtau/ViewModels/PhoneticAssistantViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void Refresh() {
Phonemes = string.Empty;
return;
}
string[] phonemes = g2p.Query(Grapheme);
string[] phonemes = g2p.Query(Grapheme.ToLowerInvariant());
if (phonemes == null) {
Phonemes = string.Empty;
return;
Expand Down
Loading