private void Validate(IStopwordsFile stopwords, FileType fileType)
 {
     if (stopwords == null && (fileType == FileType.Resume))
     {
         throw new ArgumentNullException("Stopwords are required to preprocess file: {0}.", fileType.ToString());
     }
 }
示例#2
0
 private void Validate(IStopwordsFile stopwords, ListingSource source)
 {
     if (stopwords == null && (source == ListingSource.Github))
     {
         throw new ArgumentNullException("Stopwords are required to preprocess listing: {0}.", source.ToString());
     }
 }
示例#3
0
        public ResumeFile(string path, DocumentType documentType, IStopwordsFile stopwords, IFilePreprocessFactory preprocessFactory, IDocumentReaderFactory readerFactory)
            : base(path, documentType, FileType.Resume)
        {
            var preprocess = preprocessFactory.GetPreprocess(FileType.Resume, Language.English, stopwords);

            using (var rdr = readerFactory.GetFileReader(documentType, path))
            {
                words = preprocess.Process(rdr);
            }
        }
示例#4
0
        public ResumeFile(byte[] content, DocumentType documentType, IStopwordsFile stopwords, IFilePreprocessFactory preprocessFactory, IDocumentReaderFactory readerFactory)
            : base("", documentType, FileType.Resume)
        {
            Content = content;
            var preprocess = preprocessFactory.GetPreprocess(FileType.Resume, Language.English, stopwords);

            using (var rdr = readerFactory.GetStreamReader(content))
            {
                words = preprocess.Process(rdr);
            }
        }
示例#5
0
        public IListingPreprocess GetPreprocess(ListingSource source, IStopwordsFile stopwords = null)
        {
            switch (source)
            {
            case ListingSource.Github:
                return(new GitHubPreprocess(stopwords, procFact.GetTextProcessor(NLP.Language.English)));

            default:
                throw new Exception("Failed to instantiate listing preprocess.");
            }
        }
        public IFilePreprocess GetPreprocess(FileType fileType, Language language, IStopwordsFile stopwords = null)
        {
            Validate(stopwords, fileType);
            switch (fileType)
            {
            case FileType.Resume:
                return(new ResumePreprocess(stopwords, procFact.GetTextProcessor(language)));

            case FileType.Stopwords:
                return(new StopwardsPreprocess(procFact.GetTextProcessor(language)));

            default:
                throw new Exception("Failed to instantiate file preprocess.");
            }
        }
示例#7
0
 public ResumePreprocess(IStopwordsFile stopwords, ITextProcessor textProcessor) : base(textProcessor)
 {
     this.stopwords = stopwords;
 }
示例#8
0
 public IResumeFile GetResumeFile(DocumentType documentType, IStopwordsFile stopwords, string path)
 {
     return(new ResumeFile(path, documentType, stopwords, preprocessFactory, readerFactory));
 }
示例#9
0
 public IResumeFile GetResumeFile(DocumentType documentType, IStopwordsFile stopwords, byte[] bytes)
 {
     return(new ResumeFile(bytes, documentType, stopwords, preprocessFactory, readerFactory));
 }