private UploadedTemplates GenerateUploadedTemplates(DCE_Templates template) { if (template != null) { UploadedTemplates uploadedTemplate = new UploadedTemplates { Name = template.Name, DocumentType = template.DocumentType, VirtualPath = template.VirtualPath, DateTimeUploaded = template.DateTimeUploaded.ToString(), Description = template.Description, FileID = template.FileID }; return(uploadedTemplate); } return(null); }
public List <InputtedKeyword> GenerateKeywordByInput(UploadedTemplates template, String inputKeyword) { ComputeKeywordTermFrequency keywordTF = new ComputeKeywordTermFrequency(GetOCRContent(template.FileID), GetAllOCRContentsExcludeFileID(template.FileID)); List <InputtedKeyword> keywords = new List <InputtedKeyword>(); double rate = keywordTF.GetKeywordFrequency(inputKeyword); if (rate == 0.0f) { rate = 1.0f; } keywords.Add(new InputtedKeyword { Keyword = inputKeyword, GeneratedTFRate = GetRateRound(rate), AddedFlag = CheckKeywordExists(template.FileID, inputKeyword) }); return(keywords); }
public List <InputtedKeyword> GenerateKeywordsBySystem(UploadedTemplates template) { ListUniqueKeywords listUniqueKeyword = new ListUniqueKeywords(); DictionarySpellCheck spellCheck = new DictionarySpellCheck(); String textOCR = GetOCRContent(template.FileID); List <String> ListWords = listUniqueKeyword.GetSingleKeywordsFromString(textOCR); List <String> listSentences = listUniqueKeyword.GetShortSentencesFromString(textOCR); ComputeKeywordTermFrequency keywordTF = new ComputeKeywordTermFrequency(textOCR, GetAllOCRContentsExcludeFileID(template.FileID)); List <InputtedKeyword> keywords = new List <InputtedKeyword>(); foreach (String word in ListWords) { double rate = keywordTF.GetKeywordFrequency(word); if (rate >= 0.0f && (spellCheck.IsEnglishWord(word) || spellCheck.IsNumber(word))) { if (word.Trim().Length < 4) { continue; } keywords.Add(new InputtedKeyword { Keyword = word, GeneratedTFRate = GetRateRound(rate), AddedFlag = CheckKeywordExists(template.FileID, word) }); } } foreach (String line in listSentences) { double rate = keywordTF.GetKeywordFrequency(line); if (rate >= 0.0f && spellCheck.IsEnglishSentenceOrNumbers(line)) { keywords.Add(new InputtedKeyword { Keyword = line, GeneratedTFRate = GetRateRound(rate), AddedFlag = CheckKeywordExists(template.FileID, line) }); } } return(keywords); }
public List <InputtedKeyword> GetKeywordByInput(UploadedTemplates template, String inputKeyword) { return(new DCESystemOperations().GenerateKeywordByInput(template, inputKeyword)); }
public List <InputtedKeyword> GetKeywordsGeneratedBySystem(UploadedTemplates template) { DCESystemOperations dceSysOps = new DCESystemOperations(); return(dceSysOps.GenerateKeywordsBySystem(template)); }