Skip to main content

🔠 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)

Metadata

Release files for kwmatrix 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kwmatrix 1.0.2
File Size Uploaded
kwmatrix-1.0.2.tar.gz 3.0 kB Details

Release files / kwmatrix-1.0.2.tar.gz

Download URL kwmatrix-1.0.2.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cc546d52b2221f2538f95f8b4da905144537b8325d5f191f65994c2b5799e5ff
BLAKE2b-256 checksum
How to use checksums
a1af3ec0b44750551d659150cc79a65093bc12f7a10474ac0fce40e948ed71f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page