Skip to content

Commit

Permalink
Revert "Merge pull request #1121 from EX3exp/update-ko-phonemizer-uti…
Browse files Browse the repository at this point in the history
…l-2"

This reverts commit c451fc1, reversing
changes made to 50dfc45.
  • Loading branch information
stakira committed May 10, 2024
1 parent c451fc1 commit 6b71882
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
3 changes: 2 additions & 1 deletion OpenUtau.Core/KoreanPhonemizerUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using OpenUtau.Classic;
using Serilog;
using static OpenUtau.Api.Phonemizer;
using OpenUtau.Api;

namespace OpenUtau.Core {
/// <summary>
Expand Down Expand Up @@ -371,7 +372,7 @@ private static Hashtable Variate(Hashtable firstCharSeparated, Hashtable nextCha
nextFirstConsonant = "";
}

if ((!firstLastConsonant.Equals(" ")) && nextFirstConsonant.Equals("") && (!firstLastConsonant.Equals(""))) {
if ((!firstLastConsonant.Equals("")) && nextFirstConsonant.Equals("") && (!firstLastConsonant.Equals(""))) {
// 연음 2
nextFirstConsonant = firstLastConsonant;
firstLastConsonant = " ";
Expand Down
25 changes: 10 additions & 15 deletions OpenUtau.Plugin.Builtin/KoreanCBNNPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ private Result ConvertForCBNN(Note[] notes, string[] prevLyric, string[] thisLyr
}
string frontCV;
string batchim;
string VC = $"{thisMidVowelTail} {FIRST_CONSONANTS[nextLyric[0]]}{MIDDLE_VOWELS[nextLyric[1]][1]}";
string VC = $"{thisMidVowelTail} {FIRST_CONSONANTS[nextLyric[0]]}";
string VV = $"{MIDDLE_VOWELS[prevLyric[1]][2]} {thisMidVowelTail}";
string VSv = $"{thisMidVowelTail} {MIDDLE_VOWELS[nextLyric[1]][1]}";
isItNeedsVSv = thisLyric[2] == " " && nextLyric[0] == "" && !PLAIN_VOWELS.Contains(nextLyric[1]) && FindInOto(VSv, note, true) != null;
isItNeedsVC = thisLyric[2] == " " && nextLyric[0] != "" && nextLyric[0] != "null";
isItNeedsVC = thisLyric[2] == " " && nextLyric[0] != "" && nextLyric[0] != "null" && FindInOto(VC, note, true) != null;

frontCV = $"- {CV}";
if (FindInOto(frontCV, note, true) == null) {
Expand All @@ -155,15 +155,6 @@ private Result ConvertForCBNN(Note[] notes, string[] prevLyric, string[] thisLyr
}
}

if (FindInOto(VC, note, true) == null) {
if (VC.EndsWith("w") || VC.EndsWith("y")) {
VC = VC.Substring(0, VC.Length - 1);
}
if (FindInOto(VC, note, true) == null) {
isItNeedsVC = false;
}
}

if (isItNeedsVV) {CV = VV;}


Expand Down Expand Up @@ -223,22 +214,26 @@ private Result ConvertForCBNN(Note[] notes, string[] prevLyric, string[] thisLyr
}


private string HandleEmptyFirstConsonant(string lyric) {
return lyric == " " ? "" : lyric;
}

public override Result ConvertPhonemes(Note[] notes, Note? prev, Note? next, Note? prevNeighbour, Note? nextNeighbour, Note[] prevNeighbours) {
Note note = notes[0];

Hashtable lyrics = KoreanPhonemizerUtil.Variate(prevNeighbour, note, nextNeighbour);
string[] prevLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ"
(string)lyrics[0],
HandleEmptyFirstConsonant((string)lyrics[0]),
(string)lyrics[1],
(string)lyrics[2]
};
string[] thisLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ"
(string)lyrics[3],
HandleEmptyFirstConsonant((string)lyrics[3]),
(string)lyrics[4],
(string)lyrics[5]
};
string[] nextLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ"
(string)lyrics[6],
HandleEmptyFirstConsonant((string)lyrics[6]),
(string)lyrics[7],
(string)lyrics[8]
};
Expand All @@ -262,7 +257,7 @@ public override Result GenerateEndSound(Note[] notes, Note? prev, Note? next, No
Hashtable lyrics = KoreanPhonemizerUtil.Separate(prevNeighbour_.lyric);

string[] prevLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ"
(string)lyrics[0],
HandleEmptyFirstConsonant((string)lyrics[0]),
(string)lyrics[1],
(string)lyrics[2]
};
Expand Down
12 changes: 8 additions & 4 deletions OpenUtau.Plugin.Builtin/KoreanCVPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,22 +232,26 @@ private Result ConvertForCV(Note[] notes, string[] prevLyric, string[] thisLyric
}


private string HandleEmptyFirstConsonant(string lyric) {
return lyric == " " ? "" : lyric;
}

public override Result ConvertPhonemes(Note[] notes, Note? prev, Note? next, Note? prevNeighbour, Note? nextNeighbour, Note[] prevNeighbours) {
Note note = notes[0];

Hashtable lyrics = KoreanPhonemizerUtil.Variate(prevNeighbour, note, nextNeighbour);
string[] prevLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ"
(string)lyrics[0],
HandleEmptyFirstConsonant((string)lyrics[0]),
(string)lyrics[1],
(string)lyrics[2]
};
string[] thisLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ"
(string)lyrics[3],
HandleEmptyFirstConsonant((string)lyrics[3]),
(string)lyrics[4],
(string)lyrics[5]
};
string[] nextLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ"
(string)lyrics[6],
HandleEmptyFirstConsonant((string)lyrics[6]),
(string)lyrics[7],
(string)lyrics[8]
};
Expand All @@ -271,7 +275,7 @@ public override Result GenerateEndSound(Note[] notes, Note? prev, Note? next, No
Hashtable lyrics = KoreanPhonemizerUtil.Separate(prevNeighbour_.lyric);

string[] prevLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ"
(string)lyrics[0],
HandleEmptyFirstConsonant((string)lyrics[0]),
(string)lyrics[1],
(string)lyrics[2]
};
Expand Down

0 comments on commit 6b71882

Please sign in to comment.