コード例 #1
0
        private int Intersection(SynSet synSet, List <ParseNodeDrawable> leafList)
        {
            string[] words1;
            if (synSet.GetExample() != null)
            {
                words1 = (synSet.GetLongDefinition() + " " + synSet.GetExample()).Split(" ");
            }
            else
            {
                words1 = synSet.GetLongDefinition().Split(" ");
            }
            var words2 = new string[leafList.Count];

            for (var i = 0; i < leafList.Count; i++)
            {
                words2[i] = leafList[i].GetLayerData(ViewLayerType.TURKISH_WORD);
            }
            var count = 0;

            foreach (var word1 in words1)
            {
                foreach (var word2 in words2)
                {
                    if (word1.ToLower(new CultureInfo("tr")).Equals(word2.ToLower(new CultureInfo("tr"))))
                    {
                        count++;
                    }
                }
            }
            return(count);
        }
コード例 #2
0
        private int Intersection(SynSet synSet, AnnotatedSentence.AnnotatedSentence sentence)
        {
            string[] words1;
            if (synSet.GetExample() != null)
            {
                words1 = (synSet.GetLongDefinition() + " " + synSet.GetExample()).Split(" ");
            }
            else
            {
                words1 = synSet.GetLongDefinition().Split(" ");
            }
            var words2 = sentence.ToWords().Split(" ");
            var count  = 0;

            foreach (var word1 in words1)
            {
                foreach (var word2 in words2)
                {
                    if (word1.ToLower(new CultureInfo("tr")).Equals(word2.ToLower(new CultureInfo("tr"))))
                    {
                        count++;
                    }
                }
            }
            return(count);
        }