Skip to content

Commit

Permalink
add support for loading dictionaries from Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
smdn committed Dec 25, 2022
1 parent 56c70d1 commit 751c075
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Smdn.Text.Ondulish/Smdn.Text.Ondulish/Translator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ public Translator(string taggerArgs, string dictionaryDirectory)
private static readonly char[] dictionaryPunctuationChars = new[] { '!', '?', '!', '?', '、', '。' };

private static SortedList<string, string> LoadDictionary(string dictionaryPath)
{
using var stream = File.OpenRead(dictionaryPath);

return LoadDictionary(stream);
}

private static SortedList<string, string> LoadDictionary(Stream stream)
{
var dictionary = new SortedList<string, string>(new WordDictionaryComparer());

Expand Down

0 comments on commit 751c075

Please sign in to comment.