Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kwmatrix

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kwmatrix

Combine keywords with several modifiers for SEO

  • 1.0.2
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc