No description
Find a file
2026-02-23 18:59:03 +01:00
.gitignore V2 2026-02-22 11:00:49 +01:00
README.md V2 2026-02-22 11:08:46 +01:00
variants.py keywords like _Hello_ and #Hell#o 2026-02-23 18:59:03 +01:00

Keyword Variant Generator

A powerful Python script that takes a list of keywords and generates thousands of variants by combining case styles, separators, dates, numbers, plurals, synonyms, and multi-keyword combinations. Supports both Italian and English out of the box.

No variant ever contains spaces. Words are always joined by separators (-, _, ., ,, ;, :) or fused together (camelCase, PascalCase, etc.).


Quick Start

  1. Create a keywords.txt file with one keyword per line:
web design
cheap house
seo tool
  1. Run the script:
python keyword_variants.py
  1. Find all variants in var.txt, one per line.

How It Works

The generator reads your keywords and applies the following transformations, then combines them to produce every possible variant.

Case Styles

Every keyword (and combination) is output in all of these formats:

Style Example
lowercase + separator web-design, web_design, web.design
UPPERCASE + separator WEB-DESIGN, WEB_DESIGN, WEB.DESIGN
Title Case + separator Web-Design, Web_Design, Web.Design
camelCase webDesign
PascalCase WebDesign
SCREAMING_SNAKE WEB_DESIGN
Train-Case Web-Design
joined lower webdesign
joined upper WEBDESIGN

Separators

Each case style is generated with every separator:

- · _ · . · , · ; · :

So web design becomes web-design, web_design, web.design, web,design, web;design, web:design — each in lowercase, UPPERCASE, and Title Case.

Keyword Combinations

If you provide multiple keywords, the generator creates permutations of 2, 3, or more keywords (configurable), applying all case and separator variants to each combination.

For example, given web design and cheap, it produces:

  • cheap-web-design, cheap_web_design, cheapWebDesign, ...
  • web-design-cheap, web_design_cheap, webDesignCheap, ...

Combinations also cross-multiply with plurals and synonyms, so cheap house + web design also yields affordable-homes-web-designs, budget_property_web_design, etc.

Plurals

Italian rules:

  • -o-i (gatto → gatti)
  • -a-e / -i (casa → case, problema → problemi)
  • -e-i (cane → cani)

English rules:

  • Regular: design → designs, box → boxes
  • -y-ies: strategy → strategies
  • -f-ves: knife → knives, leaf → leaves
  • 80+ irregulars: child → children, analysis → analyses, mouse → mice
  • Invariables (not pluralized): software, sheep, seo, css, html

Synonyms

Built-in synonym dictionaries for both languages. Fully customizable by editing the SINONIMI_IT and SINONIMI_EN dictionaries in the script.

Italian (15+ entries):

Keyword Synonyms
casa abitazione, appartamento, immobile
economico conveniente, lowcost
guida tutorial, manuale, corso

English (20+ entries):

Keyword Synonyms
cheap affordable, budget, lowcost, inexpensive, bargain
house home, apartment, property, flat, residence
guide tutorial, handbook, course, walkthrough, howto
review comparison, analysis, rating, evaluation
tool software, app, platform, solution, resource

Dates & Years

By default, years from 2015 to next year are appended and prepended to every keyword:

  • web-design-2025, 2025_web_design, webDesign2026, ...

Optional date features (enabled via flags):

Flag What it adds Example
--mesi Month names (IT+EN) web-design-january-2026, casa.febbraio.2026
--trimestri Quarters Q1-2026-web-design, web_design_q3_2025
--periodi Seasons & freshness summer-web-design, updated_casa_2026

Numbers

Three categories are on by default:

Category What it generates
Digits (19) web-design-3, 5_casa, 7WebDesign
Round numbers (101000) casa-100, 50_web_design, web.design.500
Top N patterns (IT+EN) top-5-web-design, 10-tips-cheap-house, 7hacks-seo-tool

The Top N patterns include templates like:

  • IT: i-{n}-migliori, {n}-consigli, {n}-trucchi, {n}-errori, {n}-strategie, ...
  • EN: {n}-best, {n}-ways-to, {n}-tips, {n}-hacks, {n}-tools, {n}-resources, ...

Six additional categories are available via flags:

Flag Category Example
--numeri-versioni Software versions casa-v2, web_design_2.0
--numeri-ordinali Ordinals (IT+EN) primo-web-design, 1st_cheap_house
--numeri-romani Roman numerals IX web-design-III, CASA_VII
--numeri-simboli Symbols #1-web-design, n.1_casa, 100%, 24/7
--numeri-intervalli Ranges 1-5-casa, top-3-5-web-design
--numeri-zero Zero-padded casa-01, web_design_007
--numeri-tutti All of the above Enables every number category

Accents

For any variant containing accented characters, a de-accented version is also generated:

  • abitazione stays as-is (no accents)
  • città → citta, perché → perche

Command-Line Options

Usage: python keyword_variants.py [OPTIONS]

Options:
  --lang {it,en,both}     Language (default: both)
  -i, --input FILE        Input file (default: keywords.txt)
  -o, --output FILE       Output file (default: var.txt)
  --max-combo N           Max keywords per combination (default: 3)

Date options:
  --anno-min YEAR         Start year (default: 2015)
  --anno-max YEAR         End year (default: current + 1)
  --mesi                  Include month names
  --trimestri             Include Q1Q4
  --periodi               Include seasons and freshness words
  --no-date               Disable all date/year variants

Number options:
  --no-numeri             Disable all number variants
  --numeri-tutti          Enable ALL number categories
  --numeri-versioni       Include software versions (v1, 2.0)
  --numeri-ordinali       Include ordinals (1st, primo)
  --numeri-romani         Include roman numerals (IX)
  --numeri-simboli        Include symbols (#1, 100%, 24/7)
  --numeri-intervalli     Include ranges (1-5, 1-10)
  --numeri-zero           Include zero-padded (01, 007)

Other options:
  --no-plurali            Disable plural generation
  --no-sinonimi           Disable synonym expansion
  --no-accenti            Disable accent-stripped variants
  --no-combinazioni       Disable multi-keyword combinations

Examples

Basic usage — read keywords.txt, write var.txt:

python keyword_variants.py

English only, with all numbers:

python keyword_variants.py --lang en --numeri-tutti

Italian only, with months and quarters:

python keyword_variants.py --lang it --mesi --trimestri

Custom files and year range:

python keyword_variants.py -i my_keywords.txt -o results.txt --anno-min 2020 --anno-max 2026

Minimal — just case + separators, no extras:

python keyword_variants.py --no-date --no-numeri --no-sinonimi --no-plurali

Limit combinations to pairs only:

python keyword_variants.py --max-combo 2

Input File Format

keywords.txt is a plain text file with one keyword per line. Blank lines and lines starting with # are ignored.

# Main product keywords
web design
cheap house

# Brand terms
seo tool
content marketing

Keywords can be single words or multi-word phrases. The script automatically splits them into individual words for case/separator processing. It also handles input in camelCase, PascalCase, or with separators already present:

webDesign        → split into: web, design
content-marketing → split into: content, marketing
SEO_Tool         → split into: seo, tool

Output Scale

The number of variants depends on how many keywords you provide and which features are enabled. Here are some benchmarks:

Keywords Features Variants
2 case + separators only ~500
2 + plurals + synonyms ~4,800
2 + dates + numbers ~50,000+
3 all defaults ~50,000350,000+
3 + --numeri-tutti + --mesi 800,000+

Tip: Start with --no-date --no-numeri to preview the base variants, then incrementally enable features.


Customization

Adding Synonyms

Edit the SINONIMI_IT and SINONIMI_EN dictionaries at the top of the script:

SINONIMI_EN = {
    "cheap": ["affordable", "budget", "lowcost", "inexpensive", "bargain"],
    # Add your own:
    "laptop": ["notebook", "ultrabook", "chromebook"],
}

Adding Number Patterns

Edit PREFISSI_NUMERICI_PAROLE_EN or PREFISSI_NUMERICI_PAROLE_IT:

PREFISSI_NUMERICI_PAROLE_EN = [
    ["top"], ["best"], ["{n}", "best"],
    # Add your own:
    ["{n}", "proven"], ["{n}", "essential"], ["{n}", "must", "have"],
]

Changing Separators

Edit the SEPARATORI list:

SEPARATORI = ["-", "_", ".", ",", ";", ":"]
# Reduce to fewer separators:
SEPARATORI = ["-", "_"]  # Only hyphens and underscores

Requirements

  • Python 3.6+
  • No external dependencies (standard library only)

License

MIT