Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
            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);
            }
Ejemplo n.º 3
0
            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);
            }
Ejemplo n.º 4
0
 public List <InputtedKeyword> GetKeywordByInput(UploadedTemplates template, String inputKeyword)
 {
     return(new DCESystemOperations().GenerateKeywordByInput(template, inputKeyword));
 }
Ejemplo n.º 5
0
        public List <InputtedKeyword> GetKeywordsGeneratedBySystem(UploadedTemplates template)
        {
            DCESystemOperations dceSysOps = new DCESystemOperations();

            return(dceSysOps.GenerateKeywordsBySystem(template));
        }