Example #1
0
        public tfidf(NGramsEnum ngrams, CutThresholdEnum cutThreshold)
        {
            _Ngrams       = ngrams;
            _CutThreshold = cutThreshold;

            _WordsByDocsHashset = new HashSet <string>();
            _DocWordsList       = new List <Dictionary <string, int> >();

            _WordsCountByDocList = new List <int>();
            _Sb = new StringBuilder();
        }
Example #2
0
        private static float?GetCutPercent(NGramsEnum ngrams, CutThresholdEnum cutThreshold)
        {
            switch (cutThreshold)
            {
            //case CutThresholdEnum.cut_0: return (null);
            case CutThresholdEnum.cut_1:
            {
                switch (ngrams)
                {
                case NGramsEnum.ngram_1: return(100 - 5);

                case NGramsEnum.ngram_2: return(100 - 50);

                case NGramsEnum.ngram_3: return(100 - 85);

                case NGramsEnum.ngram_4: return(100 - 95);
                    //default: return (null);
                }
            }
            break;

            case CutThresholdEnum.cut_2:
            {
                switch (ngrams)
                {
                case NGramsEnum.ngram_1: return(100 - 50);

                case NGramsEnum.ngram_2: return(100 - 85);

                case NGramsEnum.ngram_3: return(100 - 95);

                case NGramsEnum.ngram_4: return(100 - 98);
                    //default: return (null);
                }
            }
            break;
                //default: return (null);
            }
            return(null);
        }