private bool isModelInTitle(string productModel, string listingTitle) { bool res = true; productModel = Preprocessor.pre_process(productModel); listingTitle = Preprocessor.pre_process(listingTitle); ArrayList productModelParts = LCS.convert(productModel); for (int i = 0; i < productModelParts.Count; i++) { if (listingTitle.IndexOf(Convert.ToString(productModelParts[i])) == -1) { res = false; break; } } return(res); }
private List <Match> matchProducts_with_Listings(List <Product> products, List <Listing> listings) { rtbConsole.Clear(); List <Match> matches = new List <Match>(); int i = 1; int f = 1000; foreach (Product product in products) { if (f-- > 0) { Match match = new Match(); match.ProductName = product.Name; foreach (Listing listing in listings) { if (!listing.Assigned) { if (Preprocessor.pre_process(product.Manufacturer) == Preprocessor.pre_process(listing.Manufacturer)) { if (isModelInTitle(product.Model, listing.Title)) { double nlcs_score = LCS.normalized_lcs(Preprocessor.pre_process(product.Name), Preprocessor.pre_process(listing.Title)); listing.Score = nlcs_score; if (nlcs_score >= Convert.ToDouble(nudMinSimScore.Value))// can be found using machine learning techniques { match.Listings.Add(listing); listing.Assigned = true; } } } } } matches.Add(match); rtbConsole.AppendText("product " + i++.ToString() + " of " + products.Count + "\n"); rtbConsole.Focus(); Application.DoEvents(); } } return(matches); }