예제 #1
0
        public async Task Load(string fileName)
        {
            Lines.AddRange(await DictionaryFile_Helper.Load(fileName));

            var lines = Lines.ToLookup(x => x.SimplifiedChinese).Select(coll => coll.First()).ToList();

            FR = new FastReplace(lines.Where(x => x.Enable).OrderByDescending(x => x.SimplifiedChinese_Priority).ThenByDescending(x => x.SimplifiedChinese.Length).ToDictionary(x => x.SimplifiedChinese, x => x.TraditionalChinese));

            lines    = Lines.ToLookup(x => x.TraditionalChinese).Select(coll => coll.First()).ToList();
            FRRevert = new FastReplace(lines.Where(x => x.Enable).OrderByDescending(x => x.TraditionalChinese_Priority).ThenByDescending(x => x.TraditionalChinese.Length).ToDictionary(x => x.TraditionalChinese, x => x.SimplifiedChinese));
        }
예제 #2
0
        public void Reload()
        {
            var lines = Lines.ToLookup(x => x.SimplifiedChinese).Select(coll => coll.First()).ToList();

            FR = new FastReplace(lines.Where(x => x.Enable).OrderByDescending(x => x.SimplifiedChinese_Priority).ThenByDescending(x => x.SimplifiedChinese.Length).ToDictionary(x => x.SimplifiedChinese, x => x.TraditionalChinese));

            lines    = Lines.ToLookup(x => x.TraditionalChinese).Select(coll => coll.First()).ToList();
            FRRevert = new FastReplace(lines.Where(x => x.Enable).OrderByDescending(x => x.TraditionalChinese_Priority).ThenByDescending(x => x.TraditionalChinese.Length).ToDictionary(x => x.TraditionalChinese, x => x.SimplifiedChinese));
            ReservedWordTable.Clear();
            ReservedWordTable_Revert.Clear();
            lines.Where(x => x.Enable).Where(x => x.SimplifiedChinese_Priority == 9999 && x.TraditionalChinese_Priority == 9999 && x.SimplifiedChinese == x.TraditionalChinese).ToList().ForEach(x => InsertTo_ReservedWordTable(x.SimplifiedChinese));
            FR_Reserved       = new FastReplace(ReservedWordTable);
            FRRevert_Reserved = new FastReplace(ReservedWordTable_Revert);
        }
예제 #3
0
 public void ReloadFastReplaceDic()
 {
     FR       = new FastReplace(_dictionary);
     FRRevert = new FastReplace(_dictionaryRevert);
 }