Skip to main content

Synthetic Data Generation for Window Titles

Generating synthetic window title data using NLP augmentation technique.

Overview

This project provides tools to generate synthetic data from window title strings collected from various applications. It supports two primary methods:

  • Substitution: Uses a BERT-based model to substitute words in context.
  • Substitution With N Variants: Uses a BERT-based model to substitute words in context, creating N variants of each window title.
  • Random Augmentation: Applies random swap, delete, or insert operations, with a fallback to contextual substitution when necessary.

Requirements

📦 Installation

To install the package, run

pip install synthetic-window-titles@git+https://github.com/paxray/synthetic-window-titles.git

to install without cloning the repository. If the repository is already cloned, running

pip install .

in the root folder also works.

Configuration

All configurable parameters live in constants.py. Here’s a full list of fields and example values:

  • PRESERVE_WORDS: List of substrings to keep intact during augmentation. (optional)

    PRESERVE_WORDS = [
        " Google Chrome", " Microsoft Edge", " Word ",
        " NAME ", "YEAR", "Explorer", "Outlook", " PKF "
    ]
    
  • METHOD: Integer selector for the active augmentation strategy (mandatory):

    • 1 ⇒ single contextual substitution
    • 2 ⇒ multiple contextual variants (requires N_VARIANTS)
    • 3 ⇒ random augmentation
    METHOD = 1
    
  • AUG_PERCENTAGE: Tune how many tokens are augmented. (mandatory if Method = 1 or 2):

    AUG_PERCENTAGE = 0.3   # used by substitution methods
    N_VARIANTS = 3        # used when METHOD == 2
    
  • N_VARIANTS: Tune how many variants to generate. (mandatory if Method = 2):

  • INPUT_FILE_PATH, OUTPUT_FILE_PATH: Source and destination JSON files.

    INPUT_FILE_PATH = r"src\data\input\windowTitlesTranslated.json"
    OUTPUT_FILE_PATH = r"src\data\output\syntheticDataUsingRandomAugmentation.json"
    

Usage

  1. Select an augmentation method by setting the METHOD constant in constants.py:

    • '1' for a single substitution pass
    • '2' to generate multiple contextual variants (controlled by N_VARIANTS)
    • '3' for a random augmentation
  2. Configure augmentation parameters in the same file:

    • AUG_PERCENTAGE determines the probability of applying contextual substitution
    • N_VARIANTS (used when METHOD is 2) specifies how many variants to create per input
  3. Run the main script from the project root:

    • python main.py
  4. Inspect your results at the location defined by OUTPUT_FILE_PATH. The script will load window titles from INPUT_FILE_PATH, apply the chosen augmentation strategy, and write the synthetic dataset accordingly.

Project Structure

.
└── src
    ├── common.py                                 # Shared utility functions
    ├── constants.py                              # Configuration constants
    ├── main.py                                   # Entry point script
    ├── syntheticData.py                          # Data preparation logic
    ├── syntheticDataUsingRandomAugmentation.py   # Random augmentation implementation
    ├── syntheticDataUsingSubstitution.py         # Contextual substitution implementation
    └── data
        ├── input
        │   └── windowTitlesTranslated.json   # Example input file
        └── output
            └── syntheticDataUsingRandomAugmentation.json  # Example output file

Metadata

Release files for synthetic-window-titles 0.1.0

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

Source distribution (sdist)

Source distribution for synthetic-window-titles 0.1.0
File Size Uploaded
synthetic_window_titles-0.1.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synthetic-window-titles 0.1.0
File Interpreter ABI Platform
synthetic_window_titles-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / synthetic_window_titles-0.1.0.tar.gz

Download URL synthetic_window_titles-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9273760cb4e0125239389723cb7557902a43738a1fad2c3cb97878a1a78a5760
BLAKE2b-256 checksum
How to use checksums
1159906a8e180cadf8fc086d8efa811f3dc3193e17808c93e5c6315579f5409d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.11

Release files / synthetic_window_titles-0.1.0-py3-none-any.whl

Download URL synthetic_window_titles-0.1.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
482b7c70f978753341c9620802ca9b90fdcb3583220283d613d37a7a1cda9eca
BLAKE2b-256 checksum
How to use checksums
e8af7f291d2e6808d473832d62c58a56ec518b377a4aad35074c13097d7cd4f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.1.0 This release

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