Ejemplo n.º 1
0
        private void MyInit()
        {
            ISimilarity editdistance = new Leven();

            getSimilarity = new Similarity(editdistance.GetSimilarity);

            //ISimilarity lexical=new LexicalSimilarity() ;
            //getSimilarity=new Similarity(lexical.GetSimilarity) ;

            Tokeniser tokeniser = new Tokeniser();

            _leftTokens  = tokeniser.Partition(_lString);
            _rightTokens = tokeniser.Partition(_rString);
            if (_leftTokens.Length > _rightTokens.Length)
            {
                string[] tmp = _leftTokens;
                _leftTokens  = _rightTokens;
                _rightTokens = tmp;
                string s = _lString; _lString = _rString; _rString = s;
            }

            leftLen  = _leftTokens.Length - 1;
            rightLen = _rightTokens.Length - 1;
            Initialize();
        }
Ejemplo n.º 2
0
        private void Search_Click(object sender, EventArgs e)
        {
            int m;

            if (Words == null || !Int32.TryParse(max.Text, out m))
            {
                return;
            }
            String a = Pattern.Text;

            WordList.Items.Clear();
            WordList.BeginUpdate();
            foreach (String x in Words)
            {
                if (checkBox1.Checked == true)
                {
                    if ((Leven.damerau_levenshtein_distance(x, Pattern.Text)) <= m)
                    {
                        WordList.Items.Add(x);
                    }
                }
                if (checkBox1.Checked == false)
                {
                    if ((Leven.Distance(x, Pattern.Text)) <= m)
                    {
                        WordList.Items.Add(x);
                    }
                }
            }
            WordList.EndUpdate();
        }
        private void MyInit()
        {
            ISimilarity editdistance = new Leven();
            getSimilarity = new Similarity(editdistance.GetSimilarity);

            //ISimilarity lexical=new LexicalSimilarity() ;
            //getSimilarity=new Similarity(lexical.GetSimilarity) ;

            Tokeniser tokeniser = new Tokeniser();
            _leftTokens = tokeniser.Partition(_lString);
            _rightTokens = tokeniser.Partition(_rString);
            if (_leftTokens.Length > _rightTokens.Length)
            {
                string[] tmp = _leftTokens;
                _leftTokens = _rightTokens;
                _rightTokens = tmp;
                string s = _lString; _lString = _rString; _rString = s;
            }

            leftLen = _leftTokens.Length - 1;
            rightLen = _rightTokens.Length - 1;
            Initialize();
        }