1.0.1 • Published 4 years ago

google-taxonomy-matcher v1.0.1

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

google-taxonomy-matcher

Matches unstructured product data to a category of Google's Taxonomy for use with Merchant Center Feeds.

Install

npm install google-taxonomy-matcher --save

Usage

const taxonomyMatcher = require('google-taxonomy-matcher');

// new taxonomyMatcher(<taxonomy locale>, <match threshold>)
// <taxonomy locale> = the locale extension of the taxonomy file from Google 
// <match threshold> = how close the search term must be to the matched result
const matcher = new taxonomyMatcher('en-GB', 100)

// matcher.match(<search term>, <minisearch opts>)
// <search term> = Your unstructured search query, E.G. "product title + product category"
// <minisearch opts> see -> https://www.npmjs.com/package/minisearch
matcher.match('Roll Up Cotton Chino Shorts Womens > Shorts > Casual')
/*{ 
  id: 207, // Matched Google Category ID
  terms: [ 'shorts' ], // Searched Terms
  score: 457.7377034211667, // Matched Score (see <match threshold>)
  match: { shorts: [ 'category', 'full_path_scrubbed' ] }, // Matched Terms
  full_path: 'Clothing & Accessories > Clothing > Shorts'  // Matched Google Category
}*/

Links

Google Merchant Center -> https://support.google.com/merchants/answer/6324436 MiniSearch -> https://www.npmjs.com/package/minisearch Python Version -> https://github.com/BernhardWenzel/google-taxonomy-matcher Inspiration -> https://bernhardwenzel.com/articles/automatically-matching-category-google-shopping/

Disclaimer

D3VL Provides this software 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.