Skip to main content

Combine keywords with several modifiers for SEO

Project description

🔠 kwmatrix: Combine keywords with several modifiers for SEO

Keyword 'matrixing' is the process of taking one or more seed keywords and combining it with every combination of modifier keywords.

For example, the following seed keywords contain replacement variables:

  • %color shoes
  • %color %type shoes

Given the following modifiers:

  • color: red, blue
  • type: walking, leather

These would be combined with the seed keywords to give the following result:

  • red shoes
  • blue shoes
  • red walking shoes
  • blue walking shoes
  • red leather shoes
  • blue leather shoes

This process makes it very quick and easy to create large lists of potential keywords for SEO. The kwmatrix package for Python makes this process very straightforward.

Installation

kwmatrix can be installed using the pip package manager:

pip install kwmatrix

Alternatively, using pipenv:

pipenv install kwmatrix

It can then be imported in the usual way:

import kwmatrix

Usage

kwmatrix has a single function: matrix(). This has 2 required arguments and a third optional argument:

seeds: list
A list of seed keywords with variables to replace. Each variable name is preceded by a `%` character e.g. "%color %type shoes".
modifiers: dict
A dictionary of modifier keywords to replace the variables in the seed keywords. Each key should match the name of a %variable, and the value should be a list of values insert in its place.
var_char: str (optional)
A single character to use for variables instead of the default `%`. Provide this argument if the default choice is causing issues with your keyword set.

The matrix() function will return a generator. When iterated upon, it will produce a dictionary for each result containing the final keyword and the %variables used, e.g.:

{'color': 'red', 'type': 'walking', 'keyword': 'blue walking shoes'}

Example

from kwmatrix import matrix

SEEDS = [
    '%color shoes',
    '%color %type shoes'
]
MODIFIERS = {
    'color': ['red', 'blue'],
    'type': ['walking', 'leather']
}

results = matrix(SEEDS, MODIFIERS)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kwmatrix-1.0.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

kwmatrix-1.0.1-py3-none-any.whl (15.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page