コード例 #1
0
        public IEnumerable <IGrouping <string, CodePoint> > FindRelated(CodePoint codePoint)
        {
            similar.TryGetValue(codePoint.ToString(), out var resultList);
            IEnumerable <string> result = resultList ?? Enumerable.Empty <string>();

            return(EnumerableExt.OfSingle(new CategoryGrouping <CodePoint>("Similar Kanji",
                                                                           result.Select(r => CodePoint.FromString(r)))));
        }
コード例 #2
0
        public IEnumerable <CodePoint> FindSimilar(CodePoint point)
        {
            var oppositeSizedCp = OppositeSizedVersionOf(point.Utf32);
            var oppositeSized   = (oppositeSizedCp != null
                ? Enumerable.Repeat(char.ConvertFromUtf32(oppositeSizedCp.Value), 1)
                : Enumerable.Empty <string>())
                                  .Select(s => CodePoint.FromString(s));

            mapping.TryGetValue(point.ToString(), out var restStr);
            restStr = restStr ?? new List <string>();

            // TOFIX: support combo kana
            var rest = restStr
                       .Where(s => s.Length == 1)
                       .Select(s => CodePoint.FromString(s));

            return(oppositeSized.Concat(rest));
        }