protected override void SpecificProcess(IExplodedReview <Album> explodedReview) { //Parse Country ParseCountry(explodedReview); //Parse AlbumType ParseAlbumType(explodedReview); //Parse Style ParseAlbumStyle(explodedReview); //Parse Label & Vendor ParseAlbumLabelAndVendor(explodedReview); }
private void ParseAlbumLabelAndVendor(IExplodedReview <Album> explodedReview) { var review = explodedReview as AlbumExplodedReview; if (review == null) { throw new InvalidCastException("explodedReview cannot be cast as AlbumExplodedReview"); } LabelVendor labelVendor = null; if (_albumLabelsParser.TryParse(review.AlbumLabel, review.AlbumDistributor, review.RecordLastUpdateDate, review.RecordId, ref labelVendor)) { review.ProcessedLabelVendor = labelVendor; } }
private void ParseCountry(IExplodedReview <Album> explodedReview) { var review = explodedReview as AlbumExplodedReview; if (review == null) { throw new InvalidCastException("explodedReview cannot be cast as AlbumExplodedReview"); } IList <Country> countries = null; if (_countryCodesParser.TryParse(review.ArtistCountry, review.RecordId, ref countries)) { review.ProcessedArtistCountries = countries; } }
private void ParseAlbumType(IExplodedReview <Album> explodedReview) { var review = explodedReview as AlbumExplodedReview; if (review == null) { throw new InvalidCastException("explodedReview cannot be cast as AlbumExplodedReview"); } string albumType = null; if (_albumTypesParser.TryParse(review.AlbumType, review.RecordId, ref albumType)) { review.ProcessedAlbumType = albumType; } }
private void ParseAlbumStyle(IExplodedReview <Album> explodedReview) { var review = explodedReview as AlbumExplodedReview; if (review == null) { throw new InvalidCastException("explodedReview cannot be cast as AlbumExplodedReview"); } StyleDefinition albumStyle = null; if (_albumStylesParser.TryParse(review.AlbumMusicGenre, review.RecordId, ref albumStyle)) { review.ProcessedAlbumStyle = albumStyle; } }
public string CleanReviewBody(IExplodedReview <T> explodedReview) { var result = ReviewTextCleaner.CleanText(explodedReview.RecordId, explodedReview.ReviewBody); var removalsPresenter = new RemovalsPresenter(explodedReview.RecordId, explodedReview.RecordTitle, explodedReview.ReviewerName, explodedReview.RecordCreationDate, result); // Rechercher les patterns foreach (var pattern in TextCleaningPatterns) { var regex = new Regex(pattern, RegexOptions.IgnoreCase); MatchCollection matches = regex.Matches(result); foreach (Match match in matches) { var matchString = match.Groups[1].ToString(); /*//Test to avoid to repeat DoNothing actions * if(!_reviewTextCleaner.Contains(record.Id, matchString)) * {*/ if (!removalsPresenter.MatchedStrings.ContainsKey(result.IndexOf(matchString))) { removalsPresenter.AddMatchedString(matchString, result.IndexOf(matchString)); } //} } } if (removalsPresenter.MatchedStrings.Count == 0) { return(result); } var newRemovals = _form.ShowReviewCleaningForm(removalsPresenter); foreach (KeyValuePair <Removal, bool> newR in newRemovals.Removals) { result = ReviewTextCleaner.AddAndApplyRemoval(newR.Key, newR.Value, result); } //clean de fin /*result = _reviewTextCleaner.CleanText(record.Id, result); * result = _temporaryReplacementsManager.ApplyReplacementsOn(record.Id, result, _reviewTextCleaner);*/ return(result); }
public override void Add(IExplodedReview <Album> explodedReview) { var review = explodedReview as AlbumExplodedReview; if (review == null) { throw new InvalidCastException("Cannot cast review as 'AlbumExplodedReview'"); } _explodedReviews.Add(review); var reviewer = GetOrBuildReviewer(review.ReviewerName, review.ReviewerMail, review.RecordLastUpdateDate); var artist = GetOrBuildArtist(review.ArtistName, review.ProcessedArtistCountries, review.ArtistOfficialUrl, review.RecordLastUpdateDate, reviewer, review.ArtistSimilarArtists); var chronique = new Review(review.ReviewBody, review.ReviewHits, review.ReviewScore, reviewer); var album = new Album(_albumIdGenerator.NewID(), review.AlbumName, review.AlbumReleaseDate, review.ReviewScore , review.ProcessedLabelVendor, review.AlbumCoverFileName, review.RecordLastUpdateDate, artist, reviewer, review.AlbumSimilarAlbums, review.ProcessedAlbumType , review.AlbumMusicGenre, review.ProcessedAlbumStyle, chronique); _albums.Add(album); }
public abstract void Add(IExplodedReview <T> explodedReview);
protected abstract void SpecificProcess(IExplodedReview <T> explodedReview);