コード例 #1
0
 public static KanjiOrdering Create<T>(string description, KanjiDict kanjiDict, Func<KanjiEntry, T> f)
 {
     var k = new KanjiOrdering(description)
     {
         comparer = Comparer<CodePoint>.Create((l, r) =>
         {
             var left = kanjiDict.Lookup(l.ToString()).Map(f);
             var right = kanjiDict.Lookup(r.ToString()).Map(f);
             return left.CompareTo(right);
         })
     };
     return k;
 }
コード例 #2
0
 public IEnumerable <CodePoint> LookupByRadicals(IEnumerable <CodePoint> radicals)
 {
     return(radkfile.LookupMatching(radicals.Select(r => r.ToString()))
            .OrderBy(r => kanjidict.Lookup(r)
                     .Map(e => e.StrokeCount)
                     .ValueOr(int.MaxValue))
            .Select(cp => CodePoint.FromString(cp)));
 }