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()); } }
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()); } }
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); } }
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); } }
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."); } }
public ResumePreprocess(IStopwordsFile stopwords, ITextProcessor textProcessor) : base(textProcessor) { this.stopwords = stopwords; }
public IResumeFile GetResumeFile(DocumentType documentType, IStopwordsFile stopwords, string path) { return(new ResumeFile(path, documentType, stopwords, preprocessFactory, readerFactory)); }
public IResumeFile GetResumeFile(DocumentType documentType, IStopwordsFile stopwords, byte[] bytes) { return(new ResumeFile(bytes, documentType, stopwords, preprocessFactory, readerFactory)); }