Example #1
0
        //建立索引
        private void btnAddIndex_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(tbFolderPath.Text))
            {
                WinFormControlHelper.AddLog(rtbLog, "目录不存在"); return;
            }


            string[] lsFileFullName = Directory.GetFiles(tbFolderPath.Text);

            Index.CreateIndex(Index.INDEX_DIR);
            Index.MaxMergeFactor = 301;
            Index.MinMergeDocs   = 301;

            for (int i = 0; i < lsFileFullName.Length; i++)
            {
                string strTitle   = lsFileFullName[i].Substring(lsFileFullName[i].LastIndexOf(@"\"));
                string strContent = FileHelper.ReadFromFile(lsFileFullName[i]);

                Index.IndexString("", lsFileFullName[i], strTitle, DateTime.Now, strContent);
                if (i % 300 == 0)
                {
                    Index.CloseWithoutOptimize();
                    Index.CreateIndex(Index.INDEX_DIR);
                    Index.MaxMergeFactor = 301;
                    Index.MinMergeDocs   = 301;
                }
            }
            Index.Close();
        }
Example #2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (rtbSourceText.Text.IsNullOrEmpty())
            {
                WinFormControlHelper.AddLog(rtbLog, "请输入文本!!!", "");
            }

            WinFormControlHelper.AddLog(rtbLog, "开始分词", "");
            List <string> lsStrResult = PanGuSegmentHelper.SegmentToStringList(rtbSourceText.Text);

            if (lsStrResult.IsNull())
            {
                WinFormControlHelper.AddLog(rtbLog, "无分词结果!!!", "");
                return;
            }

            WinFormControlHelper.AddLog(rtbLog, "分词数", lsStrResult.Count.ToString());
            HashSet <string> hsStrResult = new HashSet <string>();

            foreach (string str in lsStrResult)
            {
                hsStrResult.Add(str);
            }

            WinFormControlHelper.AddLog(rtbLog, "不重复数", hsStrResult.Count.ToString());
            string strResult = "";

            foreach (string str in hsStrResult)
            {
                strResult += str + "\r\n";
            }
            rtbResultText.Text = strResult;
        }
Example #3
0
 private void btnCVStart_Click(object sender, EventArgs e)
 {
     try
     {
         iResumeIDSt  = tbResumeNoSt.Text.ToInt(0);
         iResumeIDEnd = tbResumeNoSt.Text.ToInt(0);
         WinFormControlHelper.AddLog(rtbLog, "此功能暂未实现", "");
     }
     catch (Exception ex)
     { WinFormControlHelper.AddLog(rtbLog, "", ex.Message); }
 }
 private void btnUnion_Click(object sender, EventArgs e)
 {
     if (CheckCondition())
     {
         hsSetA = ReadFromFile(tbFileFUllNameA.Text);
         WinFormControlHelper.AddLog(rtbLog, "A集数量", hsSetA.Count.ToString());
         hsSetB = ReadFromFile(tbFileFUllNameB.Text);
         WinFormControlHelper.AddLog(rtbLog, "B集数量", hsSetB.Count.ToString());
         hsSetA.UnionWith(hsSetB);
         WinFormControlHelper.AddLog(rtbLog, "运算后数量", hsSetA.Count.ToString());
         SaveToFile(tbFileFUllNameC.Text, hsSetA);
     }
 }
 private void btnReSaveC_Click(object sender, EventArgs e)
 {
     if (tbFileFUllNameC.Text.IsNullOrEmpty())
     {
         WinFormControlHelper.AddLog(rtbLog, "", "文件路径不可为空");
     }
     else
     {
         hsSetC = ReadFromFile(tbFileFUllNameC.Text);
         WinFormControlHelper.AddLog(rtbLog, "C集数量", hsSetC.Count.ToString());
         SaveToFile(tbFileFUllNameC.Text, hsSetC);
     }
 }
Example #6
0
        void GetForJD(int PositionID)
        {
            int        count         = 0;
            int        pageSize      = 100;
            int        pageNo        = 1;
            List <int> lsResumeID    = tabCVJDMatchBLL.GetInstance().GetMatchedResumeIDListForJD(pageSize, pageNo, PositionID, out count);
            string     strlsResumeID = "";

            foreach (int i in lsResumeID)
            {
                strlsResumeID += i.ToString() + ",";
            }
            WinFormControlHelper.AddLog(rtbLog, "职位 " + PositionID.ToString() + " 匹配结果", strlsResumeID);
        }
        private void frmResumeOutline_Load(object sender, EventArgs e)
        {
            try
            {
                #region


                #endregion
            }
            catch (Exception ex)
            {
                WinFormControlHelper.AddLog(rtbLog, "frmResumeOutline_Load", ex.Message);
            }
        }
Example #8
0
        void MatchForCV(int ResumeID)
        {
            try
            {
                #region
                tabResumeOutlineModel modelRmOtln = tabResumeOutlineBLL.GetInstance().GetModel(ResumeID);

                #endregion
            }
            catch (Exception ex)
            {
                WinFormControlHelper.AddLog(rtbLog, "MatchForCV", ex.Message);
            }
        }
        private void btnStart_Click(object sender, EventArgs e)
        {
            try
            {
                iStNo  = int.Parse(tbStNo.Text);
                iEndNo = int.Parse(tbEndNo.Text);
            }
            catch (Exception ex)
            { WinFormControlHelper.AddLog(rtbLog, "", ex.Message); }

            for (iCurNo = iStNo; iCurNo <= iEndNo; iCurNo++)
            {
                funResumeOutLine(iCurNo);
            }
        }
 private void btnBUnionA_Click(object sender, EventArgs e)
 {
     if (tbFileFUllNameA.Text.IsNullOrEmpty() || tbFileFUllNameB.Text.IsNullOrEmpty())
     {
         WinFormControlHelper.AddLog(rtbLog, "", "文件路径不可为空");
     }
     else
     {
         hsSetA = ReadFromFile(tbFileFUllNameA.Text);
         WinFormControlHelper.AddLog(rtbLog, "A集数量", hsSetA.Count.ToString());
         hsSetB = ReadFromFile(tbFileFUllNameB.Text);
         WinFormControlHelper.AddLog(rtbLog, "B集数量", hsSetB.Count.ToString());
         hsSetB.UnionWith(hsSetA);
         WinFormControlHelper.AddLog(rtbLog, "运算后数量", hsSetB.Count.ToString());
         SaveToFile(tbFileFUllNameB.Text, hsSetB);
     }
 }
Example #11
0
 private void btnSaveSkillKeywordNew_Click(object sender, EventArgs e)
 {
     try
     {
         #region
         string strKeywordNew = "";
         foreach (string str in hsCVJDSkillFull)
         {
             strKeywordNew += str + "\r\n";
         }
         FileHelper.SaveToFile(string.Format(@"{0}\CVJDKeywordNew{1}.txt", Application.StartupPath, DateTime.Now.ToString("yyyyMMddHHmmss")), strKeywordNew);
         #endregion
     }
     catch (Exception ex)
     {
         WinFormControlHelper.AddLog(rtbLog, "btnStop_Click", ex.Message);
     }
 }
Example #12
0
 private void btnJDGet_Click(object sender, EventArgs e)
 {
     try
     {
         iPositionIDSt  = tbPositionNoSt.Text.ToInt(0);
         iPositionIDEnd = tbPositionNoEnd.Text.ToInt(0);
         if (iPositionIDEnd < iPositionIDSt)
         {
             iPositionIDEnd = iPositionIDSt;
         }
         for (int i = iPositionIDSt; i <= iPositionIDEnd; i++)
         {
             GetForJD(i);
         }
     }
     catch (Exception ex)
     { WinFormControlHelper.AddLog(rtbLog, "", ex.Message); }
 }
 bool CheckCondition()
 {
     if (tbFileFUllNameA.Text.IsNullOrEmpty())
     {
         WinFormControlHelper.AddLog(rtbLog, "", "文件路径不可为空");
         return(false);
     }
     if (tbFileFUllNameB.Text.IsNullOrEmpty())
     {
         WinFormControlHelper.AddLog(rtbLog, "", "文件路径不可为空");
         return(false);
     }
     if (tbFileFUllNameC.Text.IsNullOrEmpty())
     {
         WinFormControlHelper.AddLog(rtbLog, "", "文件路径不可为空");
         return(false);
     }
     return(true);
 }
Example #14
0
        //搜索
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (tbKeyWord.Text == "")
            {
                WinFormControlHelper.AddLog(rtbLog, "请输入关键字"); return;
            }

            string           indexDir = Index.INDEX_DIR;
            int              recCount = 0;
            List <IndexItem> lsResult = Index.Search(indexDir, tbKeyWord.Text, 1000, 1, out recCount);

            dgvResult.Rows.Clear();
            for (int i = 0; i < lsResult.Count; i++)
            {
                DataGridViewRow dgvr = new DataGridViewRow();
                dgvr.CreateCells(dgvResult);
                dgvr.Cells[0].Value = i.ToString();
                dgvr.Cells[1].Value = lsResult[i].Url;
                dgvResult.Rows.Add(dgvr);
            }
        }
Example #15
0
        void funResumeOutLine(int ResumeID)
        {
            try
            {
                #region


                WinFormControlHelper.AddLog(rtbLog, "开始操作" + ResumeID, "");
                int    count  = 0;
                string _where = "";
                string _order = " id desc";
                //获取详情
                tabResumeModel modelRm = tabResumeBLL.GetInstance().GetModel(ResumeID);
                _where = string.Format(" id={0} ", modelRm.ParentID);
                tabUserModel modelUsr = tabUserBLL.GetInstance().GetModel(_where, 0);
                if (modelUsr.IsNull())
                {
                    modelUsr = new tabUserModel();
                }
                _where = string.Format(" ParentID={0} ", modelRm.id);
                List <tabExperienceEduModel> lsmodelEdu = tabExperienceEduBLL.GetInstance().GetModelList(20, 1, _where, _order, out count);
                if (lsmodelEdu.IsNull())
                {
                    lsmodelEdu = new List <tabExperienceEduModel>();
                }
                List <tabExperienceWorkModel> lsmodelWork = tabExperienceWorkBLL.GetInstance().GetModelList(20, 1, _where, _order, out count);
                if (lsmodelWork.IsNull())
                {
                    lsmodelWork = new List <tabExperienceWorkModel>();
                }
                List <tabExperienceProjectModel> lsmodelProject = tabExperienceProjectBLL.GetInstance().GetModelList(20, 1, _where, _order, out count);
                if (lsmodelProject.IsNull())
                {
                    lsmodelProject = new List <tabExperienceProjectModel>();
                }
                //组合成新的模型
                bool IsExist = false;
                _where = string.Format(" ResumeID={0} ", modelRm.id);
                tabResumeOutlineModel modelRmOtln = tabResumeOutlineBLL.GetInstance().GetModel(_where, 0);
                IsExist = modelRmOtln.IsNotNull();
                if (!IsExist)
                {
                    modelRmOtln = new tabResumeOutlineModel();
                }
                #region
                modelRmOtln.ResumeID     = modelRm.id;
                modelRmOtln.ResumeNo     = modelRm.ResumeNo;
                modelRmOtln.ResumeName   = modelRm.ResumeName;
                modelRmOtln.HopeAddress  = modelRm.HopeAddress;
                modelRmOtln.HopeIndustry = modelRm.HopeIndustry;
                modelRmOtln.HopePosition = modelRm.HopePosition;
                modelRmOtln.HopeSalary   = modelRm.HopeSalary;
                modelRmOtln.RealName     = modelUsr.RealName;
                modelRmOtln.Birthday     = modelUsr.Birthday;
                modelRmOtln.Mobile       = modelUsr.Mobile;
                modelRmOtln.Email        = modelUsr.Email;
                modelRmOtln.Sex          = modelUsr.Sex;
                string strSkill = modelRm.Other + " ";
                #region
                modelRmOtln.School = "";
                modelRmOtln.Major  = "";
                foreach (tabExperienceEduModel model in lsmodelEdu)
                {
                    modelRmOtln.School += model.SchoolName + " ";
                    modelRmOtln.Major  += model.ProfessionalName + " ";
                }
                #endregion
                #region
                foreach (tabExperienceWorkModel model in lsmodelWork)
                {
                    strSkill += model.PositionDuties + " " + model.WorkPerformance + " ";
                }
                #endregion
                #region
                foreach (tabExperienceProjectModel model in lsmodelProject)
                {
                    strSkill += model.ProjectDesc + " " + model.ProjectPerformance + " ";
                }
                #endregion
                #region  Skill
                //
                List <string> lsSkill = PanGuSegmentHelper.SegmentToStringList(strSkill); //分词
                hsCVSkill = new HashSet <string>();
                foreach (string key in lsSkill)                                           //加入集合
                {
                    hsCVSkill.Add(key);
                    hsCVJDSkillFull.Add(key);
                }
                //获得交集
                hsCVSkill.IntersectWith(hsCVJDKeyWord);
                //转化成字符串
                strSkill = "";
                foreach (string str in hsCVSkill)
                {
                    strSkill += str + " ";
                }
                modelRmOtln.Skill = strSkill;
                WinFormControlHelper.AddLog(rtbLog, modelRmOtln.ResumeName, modelRmOtln.Skill);
                #endregion
                #endregion
                //插入或更新
                if (IsExist)
                {
                    tabResumeOutlineBLL.GetInstance().Update(modelRmOtln);
                }
                else
                {
                    tabResumeOutlineBLL.GetInstance().Add(modelRmOtln);
                }

                #endregion
            }
            catch (Exception ex)
            {
                WinFormControlHelper.AddLog(rtbLog, "funResumeOutLine", ex.Message);
            }
        }
Example #16
0
        void MatchForJD(int PositionID)
        {
            try
            {
                #region
                //
                List <tabCVJDMatchModel> slsCVJDMatch = new List <tabCVJDMatchModel>();//用于存放匹配结果,最大数量为100
                slsCVJDMatch.Capacity = 100;
                //
                #region 获取JD简要模型
                tabPositionOutlineModel modelPosOtln = tabPositionOutlineBLL.GetInstance().GetModel(" PositionID=" + PositionID + " ", 0);
                if (modelPosOtln.IsNull())
                {
                    WinFormControlHelper.AddLog(rtbLog, "MatchForJD", "需要先进行要提取");
                }
                //Skill
                string[]         aryJDSkill = modelPosOtln.RequireSkill.Split(new char[] { ' ', ',' });
                HashSet <string> hsJDSkill  = new HashSet <string>();
                foreach (string str in aryJDSkill)
                {
                    hsJDSkill.Add(str);
                }
                hsJDSkill.Remove("");
                WinFormControlHelper.AddLog(rtbLog, "职位 " + modelPosOtln.PositionName + " 技能关键字", modelPosOtln.RequireSkill);;

                #endregion

                //粗选适合的简历
                string _where = "";
                if (modelPosOtln.RequireSchool.IsNotNull())
                {
                    _where += " ";
                }
                if (modelPosOtln.RequireXueLi.IsNotNull())
                {
                    _where += " ";
                }
                if (modelPosOtln.RequireMajor.IsNotNull())
                {
                    _where += " ";
                }
                string.Format(" id in ( select [KEY] form containstable(tabCVJDMatch,' or  or  or  ',1000) )");
                string _orderby = "";
                int    count    = 0;
                int    pageSize = 100;
                int    pageNo   = 1;
                do
                {
                    #region
                    List <int> lsResumeID = tabCVJDMatchBLL.GetInstance().GetResumeIDListForJD(pageSize, pageNo, _where.ToString(), _orderby, out count);

                    //逐个计算
                    foreach (int ResumeID in lsResumeID)
                    {
                        #region 获取CV简要模型
                        tabResumeOutlineModel modelRmOtln = tabResumeOutlineBLL.GetInstance().GetModel(" ResumeID=" + ResumeID + " ", 0);
                        //Skill
                        string[]         aryCVSkill = modelRmOtln.Skill.Split(new char[] { ' ', ',' });
                        HashSet <string> hsCVSkill  = new HashSet <string>();
                        foreach (string str in aryCVSkill)
                        {
                            hsCVSkill.Add(str);
                        }
                        hsJDSkill.Remove("");
                        WinFormControlHelper.AddLog(rtbLog, "简历" + modelRmOtln.ResumeNo + "技能关键字", modelRmOtln.Skill);;
                        #endregion

                        #region  计算匹配度
                        tabCVJDMatchModel modelMch = new tabCVJDMatchModel();
                        modelMch.PositionID = modelPosOtln.PositionID;
                        modelMch.ResumeID   = modelRmOtln.ResumeID;
                        modelMch.ResumeNo   = modelRmOtln.ResumeNo;
                        modelMch.BaseOn     = "Position";

                        hsCVSkill.IntersectWith(hsJDSkill);
                        modelMch.Skill       = (hsCVSkill.Count * 100) / hsJDSkill.Count;
                        modelMch.MatchDegree = modelMch.Skill;
                        WinFormControlHelper.AddLog(rtbLog, "简历" + modelRmOtln.ResumeNo + "综合评价", modelMch.MatchDegree.ToString());
                        #endregion

                        #region 保存到内存列表中(只保存前100条记录)
                        //是否要删除
                        if (slsCVJDMatch.Count == slsCVJDMatch.Capacity)
                        {
                            tabCVJDMatchModel modelMin = slsCVJDMatch[0];
                            foreach (tabCVJDMatchModel model in slsCVJDMatch)
                            {
                                if (model.MatchDegree < modelMin.MatchDegree)
                                {
                                    modelMin = model;
                                }
                            }
                            slsCVJDMatch.Remove(modelMin);
                        }
                        //是否添加
                        if (slsCVJDMatch.Count < slsCVJDMatch.Capacity)
                        {
                            slsCVJDMatch.Add(modelMch);
                        }


                        #endregion
                    }
                    #endregion
                    pageNo++;//
                }while (pageNo * pageSize < count);
                #region  保存至数据库
                //删除原来的
                tabCVJDMatchBLL.GetInstance().Delete(" PositionID=" + PositionID + " and BaseOn='Position' ");
                //添加新的
                string strLsResumeID = "";
                foreach (tabCVJDMatchModel model in slsCVJDMatch)
                {
                    tabCVJDMatchBLL.GetInstance().Add(model);
                    strLsResumeID += model.ResumeID.ToString() + ",";
                }
                WinFormControlHelper.AddLog(rtbLog, "职位 " + PositionID.ToString() + " 匹配结果", strLsResumeID);

                #endregion

                #endregion
            }
            catch (Exception ex)
            {
                WinFormControlHelper.AddLog(rtbLog, "MatchForJD", ex.Message);
            }
        }
Example #17
0
        void funPositionOutLine(int PositionID)
        {
            try
            {
                #region


                WinFormControlHelper.AddLog(rtbLog, "开始操作" + PositionID, "");
                int    count  = 0;
                string _where = "";
                string _order = " id desc";
                //获取详情
                tabPositionModel modelPos = tabPositionBLL.GetInstance().GetModel(PositionID);
                _where = string.Format(" id={0} ", modelPos.ParentID);
                tabOrgModel modelOrg = tabOrgBLL.GetInstance().GetModel(_where, 0);
                if (modelOrg.IsNull())
                {
                    modelOrg = new tabOrgModel();
                }

                //组合成新的模型
                bool IsExist = false;
                _where = string.Format(" PositionID={0} ", modelPos.id);
                tabPositionOutlineModel modelPosOtln = tabPositionOutlineBLL.GetInstance().GetModel(_where, 0);
                IsExist = modelPosOtln.IsNotNull();
                if (!IsExist)
                {
                    modelPosOtln = new tabPositionOutlineModel();
                }
                #region
                modelPosOtln.PositionID      = modelPos.id;
                modelPosOtln.PositionName    = modelPos.PositionName;
                modelPosOtln.RequireWorkYear = modelPos.RequireYear;
                modelPosOtln.RequireXueLi    = modelPos.RequireEdu;
                modelPosOtln.SalaryBein      = modelPos.SalaryBein;
                modelPosOtln.SalaryEnd       = modelPos.SalaryEnd;
                modelPosOtln.WordAddress     = modelPos.WordAddress;

                modelPosOtln.OrgName  = modelOrg.OrgName;
                modelPosOtln.OrgPro   = modelOrg.OrgPro;
                modelPosOtln.OrgScale = modelOrg.Scale;

                string strSkill = " ";
                strSkill += modelPos.PositionDesc + " ";
                strSkill += modelPos.RequireContent + " ";
                strSkill += modelPos.RequireAbility + " ";
                strSkill += modelPos.RequireExperience + " ";
                strSkill += modelPos.AdditionInfo + " ";
                #region  Skill
                //
                List <string> lsSkill = PanGuSegmentHelper.SegmentToStringList(strSkill); //分词
                hsJDSkill = new HashSet <string>();
                foreach (string key in lsSkill)                                           //加入集合
                {
                    hsJDSkill.Add(key);
                    hsCVJDSkillFull.Add(key);
                }
                //获得交集
                hsJDSkill.IntersectWith(hsCVJDKeyWord);
                //转化成字符串
                strSkill = "";
                foreach (string str in hsJDSkill)
                {
                    strSkill += str + " ";
                }
                modelPosOtln.RequireSkill = strSkill;
                WinFormControlHelper.AddLog(rtbLog, modelPosOtln.PositionName, modelPosOtln.RequireSkill);
                #endregion
                #endregion
                //插入或更新
                if (IsExist)
                {
                    tabPositionOutlineBLL.GetInstance().Update(modelPosOtln);
                }
                else
                {
                    tabPositionOutlineBLL.GetInstance().Add(modelPosOtln);
                }

                #endregion
            }
            catch (Exception ex)
            {
                WinFormControlHelper.AddLog(rtbLog, "funPositionOutLine", ex.Message);
            }
        }