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 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."); } }
//Github public Listing(GitHubJob job, IListingPreprocess preprocess) { source = ListingSource.Github; words = new HashSet <string>(); Url = job.Url; Title = job.Title; Location = job.Location; Body = job.Body; Company = job.Company; //TODO: figure out weird UTC format conversion - "Wed Oct 04 17:48:47 UTC 2017" //Date = DateTime.ParseExact(job.Date, "ddd MMM dd hh:mm:ss zzz yyyy", new CultureInfo("en-US"), DateTimeStyles.None); Date = new DateTime(); words = preprocess.Process(Body); }