Skip to content

Commit 7b84d3c

Browse files
committed
[v0.6.4] Edge-case crash fix
1 parent fbfd8aa commit 7b84d3c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55

66
<PropertyGroup>
7-
<Version>0.6.3</Version>
7+
<Version>0.6.4</Version>
88
<Authors>Lyrcaxis</Authors>
99
<RepositoryUrl>https://github.com/Lyrcaxis/KokoroSharp</RepositoryUrl>
1010
<PackageLicenseExpression>MIT</PackageLicenseExpression>

KokoroSharp.Tests/TokenizerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task PreprocessText(string input, string expected) {
1616
}
1717

1818
[Test]
19-
[Arguments("[Misaki](/misˈɑki/) is a G2P engine designed for [Kokoro](/kˈOkəɹO/) models.", "misˈɑki ɪz ɐ dʒˈi tˈu pˈi ˈɛndʒɪn dɪzˈaɪnd fˌɔɹ kˈOkəɹO mˈɑːdəlz")]
19+
[Arguments("[Misaki](/misˈɑki/) is a G2P engine designed for [Kokoro](/kˈOkəɹO/) models.", "misˈɑki ɪz ɐ dʒˈi tˈu pˈi ˈɛndʒɪn dɪzˈaɪnd fˌɔɹ kˈOkəɹO mˈɑːdəlz.")]
2020
[Arguments("Brits say [tomato](/təmɑːtoʊ/) instead of [tomato](/təmeɪtoʊ/).", "bɹˈɪts sˈeɪ təmɑːtoʊ ɪnstˈɛd ʌv təmeɪtoʊ")]
2121
[Arguments("Here, in this sentence, there are some commas.\nThis sentence is on another line! There are two sentences on this line.",
2222
"hˈɪɹ, ɪn ðɪs sˈɛntəns, ðɛɹˌɑːɹ sˌʌm kˈɑːməz.\nðɪs sˈɛntəns ɪz ˌɔn ɐnˈʌðɚ lˈaɪn! ðɛɹˌɑːɹ tˈu sˈɛntənsᵻz ˌɔn ðɪs lˈaɪn.")]

KokoroSharp/Processing/Tokenizer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ internal static string PreprocessText(string text, string langCode = "en-us") {
127127
return $"{m.Groups[1].Value}{u}{m.Groups[3].Value}";
128128
});
129129
text = text.Replace("/", " slash ")
130-
.Replace("\n######", "\n Subnote: ")
131-
.Replace("\n#####", "\n Minor note: ")
132-
.Replace("\n####", "\n Note: ")
133-
.Replace("\n###", "\n Minor Header: ")
134-
.Replace("\n##", "\n Subheader: ")
135-
.Replace("\n#", "\n Header: ");
130+
.Replace("\n###### ", "\n Subnote: ")
131+
.Replace("\n##### ", "\n Minor note: ")
132+
.Replace("\n#### ", "\n Note: ")
133+
.Replace("\n### ", "\n Minor Header: ")
134+
.Replace("\n## ", "\n Subheader: ")
135+
.Replace("\n# ", "\n Header: ");
136136
text = text.Replace(".com", "dot com").Replace("https://", "https ");
137137
text = text.Replace("\r\n", "\n").Replace("**", "*").Replace("‘", "\"").Replace("’", "\"");
138138
foreach (var c in currencies.Keys) { text = text.Replace(c.ToString(), $" {currencies[c]} "); } // Convert currency symbols to words (e.g., $ -> "dollar").

0 commit comments

Comments
 (0)