Exemplo n.º 1
0
        private void listBoxList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = listBoxList.SelectedIndex;

            if (index < 0)
            {
                return;
            }

            object           obj  = listBoxList.Items[index];
            SearchWordResult word = (SearchWordResult)obj;

            textBoxWord.Text             = word.Word.Word;
            numericUpDownFrequency.Value = (decimal)word.Word.Frequency;
            posCtrl.Pos = (int)word.Word.Pos;
        }
Exemplo n.º 2
0
        public int CompareTo(object obj)
        {
            SearchWordResult dest = (SearchWordResult)obj;

            if (this.SimilarRatio == dest.SimilarRatio)
            {
                return(0);
            }
            else if (this.SimilarRatio > dest.SimilarRatio)
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        }
Exemplo n.º 3
0
        public List <SearchWordResult> SearchByPos(int Pos)
        {
            Debug.Assert(m_Dict != null);

            List <SearchWordResult> result = new List <SearchWordResult>();

            foreach (T_DictStruct word in m_Dict.Dicts)
            {
                if ((word.Pos & Pos) != 0)
                {
                    SearchWordResult wordResult = new SearchWordResult();
                    wordResult.Word         = word;
                    wordResult.SimilarRatio = 0;
                    result.Add(wordResult);
                }
            }

            return(result);
        }
Exemplo n.º 4
0
        public List <SearchWordResult> SearchByLength(int length)
        {
            Debug.Assert(m_Dict != null);

            List <SearchWordResult> result = new List <SearchWordResult>();

            foreach (T_DictStruct word in m_Dict.Dicts)
            {
                if (word.Word.Length == length)
                {
                    SearchWordResult wordResult = new SearchWordResult();
                    wordResult.Word         = word;
                    wordResult.SimilarRatio = 0;
                    result.Add(wordResult);
                }
            }

            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// ͨ¹ý±éÀú·½Ê½ËÑË÷
        /// </summary>
        /// <returns></returns>
        private List <SearchWordResult> SearchByTraversal(String key)
        {
            Debug.Assert(m_Dict != null);

            List <SearchWordResult> result = new List <SearchWordResult>();

            foreach (T_DictStruct word in m_Dict.Dicts)
            {
                if (word.Word.Contains(key))
                {
                    SearchWordResult wordResult = new SearchWordResult();
                    wordResult.Word         = word;
                    wordResult.SimilarRatio = (float)key.Length / (float)word.Word.Length;
                    result.Add(wordResult);
                }
            }

            return(result);
        }