Project

diviner

0.0
No commit activity in last 3 years
No release in over 3 years
It matches from a list of categories the right category to a Product.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 2.0.1
~> 3.12

Runtime

>= 4.31.3
>= 0.9.6
 Project Readme

diviner¶ ↑

Inspired by bernhardwenzel.com/blog/2013/08/26/google-shopping-taxonomy-algorithm/

It matches from a list of categories the right category to a Product.

A Python version is here: github.com/BernhardWenzel/google-taxonomy-matcher

Example¶ ↑

The keys are the method names from your product model.

keys = [:name, :description, :categories]

You tell in weights how important is that attribute.

weights = {categories: 3, name: 2, description: 1}

That is how you use the matcher

matcher = Deviner::Match.new(weights)
matcher.model(product, keys)

matcher.match(Category.all) # result will be the matching category

If your category parent is not category or the name from your category is not name, then you can change it, by giving it in the options fields

options = {language: 'de',
           query_method: :name,
           parent_method: :category,
           has_parent: true}

matcher = Deviner::Match.new(weights)

Contributing to diviner¶ ↑

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2016 Ferhat Ziba. See LICENSE.txt for further details.