Exemple #1
0
        static void Search()
        {
            int i = 0;

            foreach (string item in lines)
            {
                List <int> data = new List <int>();
                int        j    = 0;
                foreach (string patt in allkey)
                {
                    //foreach pattern from key word will be checked in here.
                    int[] Value = boyer.BM_Matcher(item.ToLower(), patt.ToLower());
                    if (Value.Length > 0)
                    {
                        data.Add(Value[0]);
                    }
                    j++;
                }
                if (data.Count > 0)
                {
                    //add data in list for do sorting
                    OutputList insertData = new OutputList();
                    insertData.ID        = i;
                    insertData.firstWord = data[0];
                    int start = data[0];
                    if (data.Count > 1)
                    {
                        for (int p = 1; p < data.Count; p++)
                        {
                            start = start - data[p];
                        }
                        insertData.MinDistance = Math.Abs(start);
                    }
                    CalData.Add(insertData);
                }
                i++;
            }

            Sorting();
        }
Exemple #2
0
        static void Search()
        {
            int i = 0;
            foreach (string item in lines)
            {
                List<int> data = new List<int>();
                int j = 0;
                foreach (string patt in allkey)
                {
                   //foreach pattern from key word will be checked in here.
                    int[] Value = boyer.BM_Matcher(item.ToLower(), patt.ToLower());
                    if (Value.Length > 0)
                    {
                        data.Add(Value[0]);
                    }
                    j++;
                }
                if (data.Count > 0)
                {
                    //add data in list for do sorting
                    OutputList insertData = new OutputList();
                    insertData.ID = i;
                    insertData.firstWord = data[0];
                    int start = data[0];
                    if (data.Count > 1)
                    {
                        for (int p = 1; p < data.Count; p++)
                        {
                            start = start - data[p];
                        }
                        insertData.MinDistance = Math.Abs(start);
                    }
                    CalData.Add(insertData);
                }
                i++;
            }

            Sorting();
        }