Search() публичный Метод

public Search ( string inbuf, List &dm_r, List &offsetList, int opertype ) : int
inbuf string
dm_r List
offsetList List
opertype int
Результат int
Пример #1
0
        //Read each line from strTextFileName, and verify wether terms in every line are in strDictFileName
        public static void Match(string strTextFileName, DictMatch match)
        {
            List<Lemma> dm_r = new List<Lemma>();
            List<int> offsetList = new List<int>();

            StreamReader sr = new StreamReader(strTextFileName);
            while (sr.EndOfStream == false)
            {
                string strLine = sr.ReadLine();
                if (strLine.Length == 0)
                {
                    continue;
                }

                dm_r.Clear();
                offsetList.Clear();
                match.Search(strLine, ref dm_r, ref offsetList, DictMatch.DM_OUT_FMM);

                //if dm_r.Count > 0, it means some contigous terms in strLine have matched terms in the dictionary.
                for (int i = 0; i < dm_r.Count; i++)
                {
                    uint len = dm_r[i].len;
                    int offset = offsetList[i];
                    string strProp = dm_r[i].strProp;
                    string strTerm = strLine.Substring(offset, (int)len);
                    Console.WriteLine("Matched term: {0}[offset:{1}, len:{2}, prop:{3}]", strTerm, offset, len, strProp);
                }
            }
            sr.Close();

        }