Skip to content

Commit

Permalink
Merge branch 'radical-file-changes' into 'main'
Browse files Browse the repository at this point in the history
Radicals: remove duplicates and update replace glyphs

See merge request Wacton/Desu!2
  • Loading branch information
waacton committed Jan 5, 2022
2 parents 75d54e3 + a329604 commit 11ff816
Show file tree
Hide file tree
Showing 46 changed files with 1,123 additions and 357 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: mcr.microsoft.com/dotnet/sdk:5.0
image: mcr.microsoft.com/dotnet/sdk:6.0

stages:
- build
Expand Down
4 changes: 2 additions & 2 deletions Desu.ExampleConsole/Desu.ExampleConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<ApplicationIcon>Desu.ico</ApplicationIcon>
<AssemblyName>Wacton.Desu.ExampleConsole</AssemblyName>
<RootNamespace>Wacton.Desu.ExampleConsole</RootNamespace>
<Authors>William Acton</Authors>
<Company>William Acton</Company>
<LangVersion>7.1</LangVersion>
<LangVersion>10</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 1 addition & 4 deletions Desu.ExampleWpf/Desu.ExampleWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Desu.ico</ApplicationIcon>
<ApplicationIcon>..\Desu\Resources\Desu.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -101,9 +101,6 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Desu.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Desu\Desu.csproj">
<Project>{6542d85e-dbfc-4d60-a643-e3c583182ef9}</Project>
Expand Down
Binary file removed Desu.ExampleWpf/Desu.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions Desu.Tests/Desu.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand Down
27 changes: 27 additions & 0 deletions Desu.Tests/GlyphReplacement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using NUnit.Framework;
using System.Collections.Generic;
using Wacton.Desu.Radicals;

namespace Wacton.Desu.Tests
{
public class GlyphReplacement
{
[Test]
public void ByString()
{
var input = "化个并刈込尚忙扎汁犯艾邦阡老杰礼疔禹初買滴乞";
var expected = "⺅𠆢丷⺉⻌⺌⺖⺘⺡⺨⺾⻏⻖⺹⺣⺭⽧⽱⻂⺲啇𠂉";
var actual = GlyphMap.Replace(input);
Assert.That(actual, Is.EqualTo(expected));
}

[Test]
public void ByList()
{
var input = new List<string> { "化", "个", "并", "刈", "込", "尚", "忙", "扎", "汁", "犯", "艾", "邦", "阡", "老", "杰", "礼", "疔", "禹", "初", "買", "滴", "乞" };
var expected = new List<string> { "⺅", "𠆢", "丷", "⺉", "⻌", "⺌", "⺖", "⺘", "⺡", "⺨", "⺾", "⻏", "⻖", "⺹", "⺣", "⺭", "⽧", "⽱", "⻂", "⺲", "啇", "𠂉" };
var actual = GlyphMap.Replace(input);
Assert.That(actual, Is.EqualTo(expected));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using Wacton.Desu.Japanese;
using Wacton.Desu.Tests.Japanese;

namespace Wacton.Desu.Tests
namespace Wacton.Desu.Tests.Japanese
{
public static class JapaneseAssert
public static class Assertions
{
public static void AssertEntry(TestEntry testEntry, IEnumerable<IJapaneseEntry> japaneseEntries)
{
Expand Down
119 changes: 118 additions & 1 deletion Desu.Tests/Japanese/TestEntries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ public static TestEntry Withコロナ()
{
Text = "ウィズコロナ",
};

var reading2 = new TestReading
{
Text = "ウイズコロナ",
};

var sense1 = new TestSense
{
Expand All @@ -295,7 +300,7 @@ public static TestEntry Withコロナ()
{
Sequence = 2845709,
Kanjis = new List<IKanji> { kanji1 },
Readings = new List<IReading> { reading1 },
Readings = new List<IReading> { reading1, reading2 },
Senses = new List<ISense> { sense1 }
};

Expand Down Expand Up @@ -437,6 +442,118 @@ public static TestEntry 九百()

return testEntry;
}

public static TestEntry 蘇格蘭()
{
var kanji1 = new TestKanji
{
Text = "蘇格蘭",
Informations = new List<KanjiInformation> {
KanjiInformation("ateji (phonetic) reading"),
KanjiInformation("rarely-used kanji form")
}
};

var reading1 = new TestReading
{
Text = "スコットランド",
};

var sense1 = new TestSense
{
PartsOfSpeech = new List<PartOfSpeech> { PartOfSpeech("noun (common) (futsuumeishi)") },
Miscellanea = new List<Miscellaneous> { Miscellaneous("word usually written using kana alone") },
Glosses = new List<Gloss> { new Gloss("Scotland", Language("eng"), null, null) }
};

var sense2 = new TestSense
{
Glosses = new List<Gloss> {
new Gloss("Schotland", Language("dut"), null, null),
new Gloss("{afk.} Sch.", Language("dut"), null, null)
}
};

var sense3 = new TestSense
{
Glosses = new List<Gloss> {
new Gloss("Schottland (Nordteil Großbritanniens einschl. der Hebriden, Orkney- und Shetland-Inseln)", Language("ger"), null, null),
}
};

var sense4 = new TestSense
{
Glosses = new List<Gloss> { new Gloss("Шотландия", Language("rus"), null, null) }
};

var sense5 = new TestSense
{
Glosses = new List<Gloss> { new Gloss("escocia", Language("spa"), null, null) }
};

var sense6 = new TestSense
{
Glosses = new List<Gloss> { new Gloss("Skottland", Language("swe"), null, null) }
};

var testEntry = new TestEntry
{
Sequence = 1069140,
Kanjis = new List<IKanji> { kanji1 },
Readings = new List<IReading> { reading1 },
Senses = new List<ISense> { sense1, sense2, sense3, sense4, sense5, sense6 }
};

return testEntry;
}

public static TestEntry 羊水()
{
var kanji1 = new TestKanji
{
Text = "羊水",
Priorities = new List<Priority> { Priority("news2"), Priority("nf33") }
};

var reading1 = new TestReading
{
Text = "ようすい",
Priorities = new List<Priority> { Priority("news2"), Priority("nf33") }
};

var sense1 = new TestSense
{
PartsOfSpeech = new List<PartOfSpeech> { PartOfSpeech("noun (common) (futsuumeishi)") },
Fields = new List<Field> { Field("pathology") },
Glosses = new List<Gloss> { new Gloss("amniotic fluid", Language("eng"), null, null) }
};

var sense2 = new TestSense
{
Glosses = new List<Gloss> {
new Gloss("Fruchtwasser", Language("ger"), null, null),
new Gloss("Amnionflüssigkeit", Language("ger"), null, null),
new Gloss("Liquor amnii", Language("ger"), null, null)
}
};

var sense3 = new TestSense
{
Glosses = new List<Gloss> {
new Gloss("fostervatten", Language("swe"), null, null),
}
};

var testEntry = new TestEntry
{
Sequence = 1662330,
Kanjis = new List<IKanji> { kanji1 },
Readings = new List<IReading> { reading1 },
Senses = new List<ISense> { sense1, sense2, sense3 }
};

return testEntry;
}

public static TestEntry タチ()
{
Expand Down
24 changes: 15 additions & 9 deletions Desu.Tests/JapaneseEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,36 @@ public void Setup()
}

[Test]
public void 食べる() => JapaneseAssert.AssertEntry(TestEntries.食べる(), japaneseEntries);
public void 食べる() => Assertions.AssertEntry(TestEntries.食べる(), japaneseEntries);

[Test]
public void () => JapaneseAssert.AssertEntry(TestEntries.(), japaneseEntries);
public void () => Assertions.AssertEntry(TestEntries.(), japaneseEntries);

[Test]
public void βカロテン() => JapaneseAssert.AssertEntry(TestEntries.βカロテン(), japaneseEntries);
public void βカロテン() => Assertions.AssertEntry(TestEntries.βカロテン(), japaneseEntries);

[Test]
public void Withコロナ() => JapaneseAssert.AssertEntry(TestEntries.Withコロナ(), japaneseEntries);
public void Withコロナ() => Assertions.AssertEntry(TestEntries.Withコロナ(), japaneseEntries);

[Test]
public void サーターアンダギー() => JapaneseAssert.AssertEntry(TestEntries.サーターアンダギー(), japaneseEntries);
public void サーターアンダギー() => Assertions.AssertEntry(TestEntries.サーターアンダギー(), japaneseEntries);

[Test]
public void 九百() => JapaneseAssert.AssertEntry(TestEntries.九百(), japaneseEntries);
public void 九百() => Assertions.AssertEntry(TestEntries.九百(), japaneseEntries);

[Test]
public void 蘇格蘭() => Assertions.AssertEntry(TestEntries.蘇格蘭(), japaneseEntries);

[Test]
public void 羊水() => Assertions.AssertEntry(TestEntries.羊水(), japaneseEntries);

[Test]
public void タチ() => JapaneseAssert.AssertEntry(TestEntries.タチ(), japaneseEntries);
public void タチ() => Assertions.AssertEntry(TestEntries.タチ(), japaneseEntries);

[Test]
public void コンビナートキャンペーン() => JapaneseAssert.AssertEntry(TestEntries.コンビナートキャンペーン(), japaneseEntries);
public void コンビナートキャンペーン() => Assertions.AssertEntry(TestEntries.コンビナートキャンペーン(), japaneseEntries);

[Test]
public void () => JapaneseAssert.AssertEntry(TestEntries.(), japaneseEntries); // first entry in JMdict
public void () => Assertions.AssertEntry(TestEntries.(), japaneseEntries); // first entry in JMdict
}
}
24 changes: 15 additions & 9 deletions Desu.Tests/JapaneseEntryAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,36 @@ public async Task Setup()
}

[Test]
public void 食べる() => JapaneseAssert.AssertEntry(TestEntries.食べる(), japaneseEntries);
public void 食べる() => Assertions.AssertEntry(TestEntries.食べる(), japaneseEntries);

[Test]
public void () => JapaneseAssert.AssertEntry(TestEntries.(), japaneseEntries);
public void () => Assertions.AssertEntry(TestEntries.(), japaneseEntries);

[Test]
public void βカロテン() => JapaneseAssert.AssertEntry(TestEntries.βカロテン(), japaneseEntries);
public void βカロテン() => Assertions.AssertEntry(TestEntries.βカロテン(), japaneseEntries);

[Test]
public void Withコロナ() => JapaneseAssert.AssertEntry(TestEntries.Withコロナ(), japaneseEntries);
public void Withコロナ() => Assertions.AssertEntry(TestEntries.Withコロナ(), japaneseEntries);

[Test]
public void サーターアンダギー() => JapaneseAssert.AssertEntry(TestEntries.サーターアンダギー(), japaneseEntries);
public void サーターアンダギー() => Assertions.AssertEntry(TestEntries.サーターアンダギー(), japaneseEntries);

[Test]
public void 九百() => JapaneseAssert.AssertEntry(TestEntries.九百(), japaneseEntries);
public void 九百() => Assertions.AssertEntry(TestEntries.九百(), japaneseEntries);

[Test]
public void 蘇格蘭() => Assertions.AssertEntry(TestEntries.蘇格蘭(), japaneseEntries);

[Test]
public void 羊水() => Assertions.AssertEntry(TestEntries.羊水(), japaneseEntries);

[Test]
public void タチ() => JapaneseAssert.AssertEntry(TestEntries.タチ(), japaneseEntries);
public void タチ() => Assertions.AssertEntry(TestEntries.タチ(), japaneseEntries);

[Test]
public void コンビナートキャンペーン() => JapaneseAssert.AssertEntry(TestEntries.コンビナートキャンペーン(), japaneseEntries);
public void コンビナートキャンペーン() => Assertions.AssertEntry(TestEntries.コンビナートキャンペーン(), japaneseEntries);

[Test]
public void () => JapaneseAssert.AssertEntry(TestEntries.(), japaneseEntries); // first entry in JMdict
public void () => Assertions.AssertEntry(TestEntries.(), japaneseEntries); // first entry in JMdict
}
}
5 changes: 2 additions & 3 deletions Desu.Tests/KanjiAssert.cs → Desu.Tests/Kanji/Assertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using Wacton.Desu.Kanji;
using Wacton.Desu.Tests.Kanji;

namespace Wacton.Desu.Tests
namespace Wacton.Desu.Tests.Kanji
{
public static class KanjiAssert
public static class Assertions
{
public static void AssertEntry(TestEntry testEntry, IEnumerable<IKanjiEntry> kanjiEntries)
{
Expand Down
Loading

0 comments on commit 11ff816

Please sign in to comment.