Skip to content

Commit

Permalink
Merge pull request #1212 from lottev1991/KoUtauPhonSandhiFix
Browse files Browse the repository at this point in the history
[KO Classic Phonemizers] Apply Korean sandhi rules to Classic phonemizers
  • Loading branch information
stakira authored Aug 4, 2024
2 parents 35d2c3f + 7207762 commit 121872c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
11 changes: 10 additions & 1 deletion OpenUtau.Plugin.Builtin/KOtoJAPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
using System.Text;
using System.Text.RegularExpressions;
using OpenUtau.Api;
using OpenUtau.Core;
using OpenUtau.Core.Ustx;
using WanaKanaNet;

namespace OpenUtau.Plugin.Builtin {
[Phonemizer("KO to JA Phonemizer", "KO to JA", "Lotte V", language: "KO")]
public class KOtoJAPhonemizer : Phonemizer {
public class KOtoJAPhonemizer : BaseKoreanPhonemizer {
/// <summary>
/// Phonemizer for making Japanese banks sing in Korean.
/// Supports Hangul and phonetic hint (based on Japanese romaji).
Expand Down Expand Up @@ -308,6 +309,14 @@ static KOtoJAPhonemizer() {
{"m", "mu" },
};

/// <summary>
/// Apply Korean sandhi rules to Hangeul lyrics.
/// </summary>
public override void SetUp(Note[][] groups, UProject project, UTrack track) {
// variate lyrics
KoreanPhonemizerUtil.RomanizeNotes(groups, false);
}

/// <summary>
/// Gets the romanized initial, medial, and final components of the passed Hangul syllable.
/// </summary>
Expand Down
11 changes: 10 additions & 1 deletion OpenUtau.Plugin.Builtin/KoreanCVCCVPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using OpenUtau.Api;
using OpenUtau.Core;
using OpenUtau.Core.Ustx;
using static OpenUtau.Api.Phonemizer;

namespace OpenUtau.Plugin.Builtin {
[Phonemizer("Korean CVCCV Phonemizer", "KO CVCCV", "RYUUSEI", language:"KO")]
public class KoreanCVCCVPhonemizer : Phonemizer {
public class KoreanCVCCVPhonemizer : BaseKoreanPhonemizer {
static readonly string initialConsonantsTable = "ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ";
static readonly string vowelsTable = "ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ";
static readonly string YVowelsTable = "ㅣㅑㅖㅛㅠㅕ";
Expand Down Expand Up @@ -207,6 +208,14 @@ private char[] SeparateHangul(char letter) {
"l=ㄹ,ㄺ,ㄻ,ㄼ,ㄽ,ㄾ,ㄿ,ㅀ",
};

/// <summary>
/// Apply Korean sandhi rules to Hangeul lyrics.
/// </summary>
public override void SetUp(Note[][] groups, UProject project, UTrack track) {
// variate lyrics
KoreanPhonemizerUtil.RomanizeNotes(groups, false);
}

static readonly Dictionary<string, string> initialConsonantLookup;
static readonly Dictionary<string, string> ccvContinuousinitialConsonantsLookup;
static readonly Dictionary<string, string> vrcInitialConsonantLookup;
Expand Down
11 changes: 10 additions & 1 deletion OpenUtau.Plugin.Builtin/KoreanCVCPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using OpenUtau.Api;
using OpenUtau.Core;
using OpenUtau.Core.Ustx;

namespace OpenUtau.Plugin.Builtin {
[Phonemizer("KoreanCVCPhonemizer", "KO CVC", "NANA", language:"KO")]

public class KoreanCVCPhonemizer : Phonemizer {
public class KoreanCVCPhonemizer : BaseKoreanPhonemizer {

static readonly string[] naPlainVowels = new string[] { "a", "e", "a", "e", "eo", "e", "eo", "e", "o", "a", "e", "e", "o", "u", "eo", "e", "i", "u", "eu", "i", "i" };

Expand Down Expand Up @@ -91,6 +92,14 @@ string getConsonant(string str) {
return str;
}

/// <summary>
/// Apply Korean sandhi rules to Hangeul lyrics.
/// </summary>
public override void SetUp(Note[][] groups, UProject project, UTrack track) {
// variate lyrics
KoreanPhonemizerUtil.RomanizeNotes(groups, false);
}

bool isAlphaCon(string str) {
if (str == "gg") { return true; }
else if (str == "dd") { return true; }
Expand Down
11 changes: 10 additions & 1 deletion OpenUtau.Plugin.Builtin/KoreanVCVPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
using System.Text;
using System.Text.RegularExpressions;
using OpenUtau.Api;
using OpenUtau.Core;
using OpenUtau.Core.Ustx;

namespace OpenUtau.Plugin.Builtin
{
[Phonemizer("Korean VCV Phonemizer", "KO VCV", "ldc", language: "KO")]

public class KoreanVCVPhonemizer : Phonemizer
public class KoreanVCVPhonemizer : BaseKoreanPhonemizer
{
/// <summary>
/// Initial jamo as ordered in Unicode
Expand Down Expand Up @@ -39,6 +40,14 @@ public class KoreanVCVPhonemizer : Phonemizer
/// </summary>
static readonly string[] extras = { "f", "v", "th", "dh", "z", "rr", "kk", "pp", "tt" };

/// <summary>
/// Apply Korean sandhi rules to Hangeul lyrics.
/// </summary>
public override void SetUp(Note[][] groups, UProject project, UTrack track) {
// variate lyrics
KoreanPhonemizerUtil.RomanizeNotes(groups, false);
}

/// <summary>
/// Gets the romanized initial, medial, and final components of the passed Hangul syllable.
/// </summary>
Expand Down

0 comments on commit 121872c

Please sign in to comment.