Exemple #1
0
        private ReportItem ScoreWordGroup(WordGroupConfigElement wge, string resume)
        {
            ReportItem item = new ReportItem();

            string[] words  = wge.WordGroup.Split(',');
            int      weight = wge.Weight;

            string type = wge.Type;

            bool sensitive = Convert.ToBoolean(wge.CaseSensitive);

            foreach (string word in words)
            {
                int cnt = 0;

                if (sensitive)
                {
                    cnt = Regex.Matches(resume, word).Count;
                }
                else
                {
                    cnt = Regex.Matches(resume, word, RegexOptions.IgnoreCase).Count;
                }

                //TODO: make a word stat first
                //TODO: use wordstat . isimportant
                //TODO: remove comparison logic here so that we only do it in once place

                //filter noise
                if ((type == "HIT" && cnt > 0) || (type == "MISS" && cnt == 0))
                {
                    item.AddWordStats(type, word, weight, cnt);
                }
            }

            return(item);
        }
Exemple #2
0
        public ScoringReport Score()
        {
            ScoringReport report = new ScoringReport();

            ResumeScoringSection resumeScoringSection =
                ConfigurationManager.GetSection("ResumeScoring") as ResumeScoringSection;

            if (resumeScoringSection == null)
            {
                throw new ApplicationException("Failed to load ResumeScoringSection.");
            }
            else
            {
                for (int i = 0; i < resumeScoringSection.WordGroups.Count; i++)
                {
                    WordGroupConfigElement wg = resumeScoringSection.WordGroups[i];

                    report.AddReportItem(ScoreWordGroup(wg, _resume));
                }
            }

            _report = report;
            return(report);
        }