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.2.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file kwmatrix-1.0.2.tar.gz.

File metadata

  • Download URL: kwmatrix-1.0.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for kwmatrix-1.0.2.tar.gz
Algorithm Hash digest
SHA256 cc546d52b2221f2538f95f8b4da905144537b8325d5f191f65994c2b5799e5ff
MD5 cd7299f26c10637154b407170899ef7b
BLAKE2b-256 a1af3ec0b44750551d659150cc79a65093bc12f7a10474ac0fce40e948ed71f5

See more details on using hashes here.

Supported by

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