Пример #1
0
        public OperateResult <ResumePredictResult> Predict(string path, ExtractOption[] options)
        {
            OperateResult <ResumePredictResult> operateResult          = new OperateResult <ResumePredictResult>();
            IDocumentExtractService             documentExtractService = new DocumentExtractService.DocumentExtractService();
            var extractResult = documentExtractService.Extract(path, options);

            if (extractResult.Status == OperateStatus.Success)
            {
                var resumePredictResult = new ResumePredictResult
                {
                    Text   = extractResult.Data.Text,
                    Images = extractResult.Data.Images,
                    Score  = ResumeChecker.Predict(extractResult.Data.Text)
                };
                resumePredictResult.IsResume = resumePredictResult.Score >= 60;
                operateResult.Data           = resumePredictResult;
                if (!resumePredictResult.IsResume)
                {
                    operateResult.Description = string.Format("不是有效的简历格式,得分[{0}]", resumePredictResult.Score);
                }
            }
            else
            {
                operateResult.Status      = extractResult.Status;
                operateResult.Description = extractResult.Description;
            }
            return(operateResult);
        }
Пример #2
0
        public OperateResult <ResumePredictResult> PredictText(string text)
        {
            try
            {
                if (text.IsNullOrWhiteSpace())
                {
                    throw new CoreException("简历内容不能为空");
                }

                var resumePredictResult = new ResumePredictResult
                {
                    Text  = text,
                    Score = ResumeChecker.Predict(text)
                };
                resumePredictResult.IsResume = resumePredictResult.Score >= 60;

                return(new OperateResult <ResumePredictResult>(OperateStatus.Success, "操作成功", resumePredictResult));
            }
            catch (Exception ex)
            {
                return(new OperateResult <ResumePredictResult>(OperateStatus.Failure, ex.Message));
            }
        }