Esempio n. 1
0
        static public DataSet SplitString(string strInputText, enmsf_StrFilter sfTextFilter, int intMaxLengthOfWord)
        {
            DataSet dsResult = CreateSplitTableWordsSchema();

            string strDelim = " ,=+.:-_/\\{}\"\'!@#$%^&*()[]|~`;<>?«»\t\n\r";

            char[]   charrDelimiter = strDelim.ToCharArray();
            string[] strarrSplit    = strInputText.Split(charrDelimiter);

            string strToInsert = string.Empty;

            foreach (string strWord in strarrSplit)
            {
                strToInsert = strWord.Trim();
                if (strToInsert == string.Empty)
                {
                    continue;
                }

                if ((enmsf_StrFilter.sf_CapitalizeSmart & sfTextFilter) != 0)
                {
                    strToInsert = CapitalizeSmart(strToInsert, enmcpw_CapitalizeWay.cpw_KillTonosLeksis);
                }

                if ((enmsf_StrFilter.sf_DenyStopWords & sfTextFilter) != 0)
                {
                    if (EXCSStrUtl.TextProcess.StopWords.TStopWords.ExistsInAllStopWords(strToInsert))
                    {
                        strToInsert = string.Empty;
                    }
                }

                if ((strToInsert != string.Empty) && (strToInsert.Length <= intMaxLengthOfWord))
                {
                    InsertWord(dsResult, strToInsert);
                }
            }
            return(dsResult);
        }
        public static DataSet SplitString(string strInputText, enmsf_StrFilter sfTextFilter, int intMaxLengthOfWord)
        {
            DataSet dsResult = CreateSplitTableWordsSchema();

            string strDelim = " ,=+.:-_/\\{}\"\'!@#$%^&*()[]|~`;<>?«»\t\n\r";
            char[] charrDelimiter = strDelim.ToCharArray();
            string[] strarrSplit = strInputText.Split(charrDelimiter);

            string strToInsert=string.Empty;
            foreach (string strWord in strarrSplit)
            {
                strToInsert=strWord.Trim();
                if (strToInsert==string.Empty)
                {
                    continue;
                }

                if ((enmsf_StrFilter.sf_CapitalizeSmart & sfTextFilter)!=0)
                {
                    strToInsert=CapitalizeSmart(strToInsert,enmcpw_CapitalizeWay.cpw_KillTonosLeksis);
                }

                if ((enmsf_StrFilter.sf_DenyStopWords & sfTextFilter)!=0)
                {
                    if (EXCSStrUtl.TextProcess.StopWords.TStopWords.ExistsInAllStopWords(strToInsert))
                    {
                        strToInsert=string.Empty;
                    }
                }

                if ( (strToInsert!=string.Empty) && (strToInsert.Length<=intMaxLengthOfWord) )
                {
                    InsertWord(dsResult,strToInsert);
                }
            }
            return dsResult;
        }