PB Unity
commited on
Upload RunJets.cs
Browse files- RunJets.cs +18 -9
RunJets.cs
CHANGED
|
@@ -25,11 +25,11 @@ public class RunJets : MonoBehaviour
|
|
| 25 |
|
| 26 |
readonly string[] phonemes = new string[] {
|
| 27 |
"<blank>", "<unk>", "AH0", "N", "T", "D", "S", "R", "L", "DH", "K", "Z", "IH1",
|
| 28 |
-
"IH0", "M", "EH1", "W", "P", "AE1", "AH1", "V", "ER0", "F", "
|
| 29 |
"HH", "IY1", "UW1", "IY0", "AO1", "EY1", "AY1", ".", "OW1", "SH", "NG", "G",
|
| 30 |
"ER1", "CH", "JH", "Y", "AW1", "TH", "UH1", "EH2", "OW0", "EY2", "AO0", "IH2",
|
| 31 |
"AE2", "AY2", "AA2", "UW0", "EH0", "OY1", "EY0", "AO2", "ZH", "OW2", "AE0", "UW2",
|
| 32 |
-
"AH2", "AY0", "IY2", "AW2", "AA0", "
|
| 33 |
"UH0", "OY0", "..", "<sos/eos>" };
|
| 34 |
|
| 35 |
readonly string[] alphabet = "AE1 B K D EH1 F G HH IH1 JH K L M N AA1 P K R S T AH1 V W K Y Z".Split(' ');
|
|
@@ -89,12 +89,13 @@ public class RunJets : MonoBehaviour
|
|
| 89 |
}
|
| 90 |
}
|
| 91 |
// Add codes for punctuation to the dictionary
|
| 92 |
-
dict.Add(",", "
|
| 93 |
dict.Add(".", ".");
|
| 94 |
-
dict.Add("!", "
|
| 95 |
-
dict.Add("?", "
|
| 96 |
-
dict.Add("\"", "
|
| 97 |
-
// You could add extra word pronounciations here
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
public string ExpandNumbers(string text)
|
|
@@ -133,11 +134,19 @@ public class RunJets : MonoBehaviour
|
|
| 133 |
{
|
| 134 |
string output = "";
|
| 135 |
int start = 0;
|
| 136 |
-
for (int i = word.Length; i >= 0; i--)
|
| 137 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
string subword = word.Substring(start, i - start);
|
| 139 |
if (dict.TryGetValue(subword, out string value))
|
| 140 |
{
|
|
|
|
| 141 |
output += value + " ";
|
| 142 |
if (i == word.Length) break;
|
| 143 |
start = i;
|
|
|
|
| 25 |
|
| 26 |
readonly string[] phonemes = new string[] {
|
| 27 |
"<blank>", "<unk>", "AH0", "N", "T", "D", "S", "R", "L", "DH", "K", "Z", "IH1",
|
| 28 |
+
"IH0", "M", "EH1", "W", "P", "AE1", "AH1", "V", "ER0", "F", ",", "AA1", "B",
|
| 29 |
"HH", "IY1", "UW1", "IY0", "AO1", "EY1", "AY1", ".", "OW1", "SH", "NG", "G",
|
| 30 |
"ER1", "CH", "JH", "Y", "AW1", "TH", "UH1", "EH2", "OW0", "EY2", "AO0", "IH2",
|
| 31 |
"AE2", "AY2", "AA2", "UW0", "EH0", "OY1", "EY0", "AO2", "ZH", "OW2", "AE0", "UW2",
|
| 32 |
+
"AH2", "AY0", "IY2", "AW2", "AA0", "\"", "ER2", "UH2", "?", "OY2", "!", "AW0",
|
| 33 |
"UH0", "OY0", "..", "<sos/eos>" };
|
| 34 |
|
| 35 |
readonly string[] alphabet = "AE1 B K D EH1 F G HH IH1 JH K L M N AA1 P K R S T AH1 V W K Y Z".Split(' ');
|
|
|
|
| 89 |
}
|
| 90 |
}
|
| 91 |
// Add codes for punctuation to the dictionary
|
| 92 |
+
dict.Add(",", ",");
|
| 93 |
dict.Add(".", ".");
|
| 94 |
+
dict.Add("!", "!");
|
| 95 |
+
dict.Add("?", "?");
|
| 96 |
+
dict.Add("\"", "\"");
|
| 97 |
+
// You could add extra word pronounciations here e.g.
|
| 98 |
+
//dict.Add("somenewword","[phonemes]");
|
| 99 |
}
|
| 100 |
|
| 101 |
public string ExpandNumbers(string text)
|
|
|
|
| 134 |
{
|
| 135 |
string output = "";
|
| 136 |
int start = 0;
|
| 137 |
+
for (int i = word.Length; i >= 0 && start < word.Length ; i--)
|
| 138 |
+
{
|
| 139 |
+
if (i <= start)
|
| 140 |
+
{
|
| 141 |
+
start++;
|
| 142 |
+
i = word.Length + 1;
|
| 143 |
+
continue;
|
| 144 |
+
}
|
| 145 |
+
//Debug.Log(word.Length + " " + i + " " + start);
|
| 146 |
string subword = word.Substring(start, i - start);
|
| 147 |
if (dict.TryGetValue(subword, out string value))
|
| 148 |
{
|
| 149 |
+
// Debug.Log("FOUND");
|
| 150 |
output += value + " ";
|
| 151 |
if (i == word.Length) break;
|
| 152 |
start = i;
|