Skip to content

hmasdev/simple_typing_application

Repository files navigation

๐ŸŽฏ Simple Typing Application

Measure and Improve Your Typing Performance with AI-Powered Practice

GitHub top language GitHub tag (latest SemVer) GitHub GitHub last commit

Scheduled Tests

application image

โœจ Features

  • ๐Ÿค– AI-Powered Sentence Generation: Use OpenAI's GPT models or HuggingFace models to generate dynamic typing targets
  • ๐Ÿ“Š Performance Tracking: Detailed recording of your typing performance with timestamps and accuracy metrics
  • ๐ŸŒ Multi-Language Support: Full support for Japanese (Hiragana, Katakana, Kanji) and English
  • โŒจ๏ธ Flexible Input: Multiple correct input patterns (e.g., both 'ti' and 'chi' for 'ใก')
  • ๐ŸŽจ Console Interface: Clean, distraction-free typing practice environment
  • ๐Ÿ“ˆ Data Analysis Ready: Export records in JSON format for detailed analysis with pandas/matplotlib

Requirements

  • Python >= 3.10 (Python 3.10, 3.11, 3.12, and 3.13 are supported)

  • Dependencies (automatically installed):

    • click
    • langchain (>= 1.0)
    • langchain_openai
    • openai
    • pydantic (>= 2.0)
    • pynput
    • python-dotenv
    • requests
    • sshkeyboard
    • types-pynput
    • types-requests
  • OpenAI API Key (required for AI-generated typing targets)

See pyproject.toml for detailed information.

Installation

Quick Install (Recommended)

The recommended way to install is using uv, a fast Python package installer:

# Clone the repository
git clone https://github.com/hmasdev/simple_typing_application.git
cd simple_typing_application

# Install with uv (recommended)
uv sync

This will install all dependencies and set up the application for use.

Alternative Installation Methods

Using pip

pip install git+https://github.com/hmasdev/simple_typing_application.git

Install with Optional Dependencies

You can specify the following optional dependencies:

  • [extra]: Data analysis packages (pandas, matplotlib, jupyterlab, seaborn)
  • [huggingface]: HuggingFace models support (torch, transformers, etc.)
  • [dev]: Development tools (pytest, mypy, ruff, etc.)

Using uv (recommended):

git clone https://github.com/hmasdev/simple_typing_application.git
cd simple_typing_application

# Install with specific optional dependencies
uv sync --extra extra --extra huggingface

Using pip:

git clone https://github.com/hmasdev/simple_typing_application.git
cd simple_typing_application

# Install with optional dependencies
pip install ".[extra,huggingface]"

For more details, see ./pyproject.toml.

๐Ÿš€ Quick Start

  1. Clone and install:

    git clone https://github.com/hmasdev/simple_typing_application.git
    cd simple_typing_application
    uv sync
  2. Set up your OpenAI API key:

    echo "OPENAI_API_KEY=your-api-key-here" > .env
  3. Run the application:

    python -m simple_typing_application
  4. Start typing! Follow the on-screen prompts and improve your typing skills.

Usage

โš™๏ธ Configuration

You can specify some parameters with '.json'.

For example, the following .json files are valid:

The content of ./sample_config.json is as follows:

{
    "sentence_generator_type": "OPENAI",
    "sentence_generator_config": {
        "model": "gpt-5-nano",
        "temperature": 0.7,
        "openai_api_key": "HERE_IS_YOUR_API_KEY",
        "memory_size": 0,
        "max_retry": 5
    },
    "user_interface_type": "CONSOLE",
    "user_interface_config": {},
    "key_monitor_type": "PYNPUT",
    "key_monitor_config": {},
    "record_direc": "./record"
}

As default, the contents of 'sample_config.json' are used except openai_api_key. In this case, you should add an environment variable OPENAI_API_KEY which contains your API key or create .env file like

OPENAI_API_KEY={HERE_IS_YOUR_API_KEY}

๐Ÿค– Sentence Generator

You can specify the following as sentence_generator_type:

  • OPENAI: Use OpenAI API to generate typing targets (recommended: gpt-5-nano, gpt-4o, or gpt-4-turbo)
  • HUGGINGFACE: Use models available on HuggingFace to generate typing targets
  • STATIC: Use predefined typing targets that you have specified

For each sentence_generator_type, you can specify the detailed parameters as sentence_generator_config:

To see the default values, see ./simple_typing_application/models/config_models/sentence_generator_config_model.py.

๐Ÿ’ก Tip: For best results, we recommend using gpt-5-nano (fast and cost-effective) or gpt-4o (most capable) for OpenAI models.

๐Ÿ–ฅ๏ธ User Interface

You can specify the followings as user_interface_type:

  • CONSOLE: CUI

For each user_interface_type, you can specify the detailed parameters as user_interface_config:

  • CONSOLE
    • No parameters

To see the default values, see ./simple_typing_application/models/config_models/user_interface_config_model.py.

โŒจ๏ธ Key Monitor

You can specity the followings as key_monitor_type:

  • PYNPUT: pynput-based local key monitor
  • SSHKEYBOARD: sshkeyboard-based key monitor

For each key_monitor_type, you can specify the detailed parameters as key_monitor_config:

  • PYNPUT
    • No parameters
  • SSHKEYBOARD
    • No parameters

To see the default values, see ./simple_typing_application/models/config_models/key_monitor_config_model.py.

๐ŸŽฎ Launch the Application

You can launch this application with the following command:

python -m simple_typing_application -c HERE_IS_YOUR_CONFIG_FILE

If you want to launch this application with debug mode, run the following command:

python -m simple_typing_application -c HERE_IS_YOUR_CONFIG_FILE --debug

For more details, run python -m simple_typing_application --help.

โœ๏ธ Typing Practice

simple_typing_application shows typing targets through the interface which you have specified. Type correct keys.

๐Ÿ“ Note: The Typing Target (Romaji) displayed in your interface is one of the correct typing patterns. For example, when Typing Target (Hiragana) is 'ใก', both 'ti' and 'chi' are correct, although only one of them is displayed.

Available keyboard shortcuts:

  • Esc or Ctrl+c: Quit the application
  • Tab: Skip the current typing target

๐Ÿ“Š Analyze Your Typing Performance

The application records your typing in the following format in the directory specified in you config file for each typing target.

{
    "timestamp": "HERE IS TIMESTAMP THE TYPING START WITH FORMAT %Y-%m-%dT%H:%M:%S.%f",
    "typing_target": {
        "text": "HERE IS TYPING TARGET",
        "text_hiragana_alphabet_symbol": "HERE IS TRANSFORMED STRING WHICH CONTAINS ONLY HIRAGANA, ALPHABET AND SYMBOLS",
        "typing_target": [["CORRECT PATTERN. TYPICALLY ROMANIZED STRING", ...], ...]
    },
    "records": [
        {
            "timestamp": "HERE IS TIMESTAMP WHEN YOU TYPE %Y-%m-%dT%H:%M:%S.%f",
            "pressed_key": "WHICH KEY YOU HAVE PRESSED",
            "correct_keys": ["", ...],
            "is_correct": true or false
        },
        ...
    ]
}

Refer to ./sample_record.json for an example.

๐Ÿ› ๏ธ Development

  1. Fork this repository:

  2. Clone your forked repository:

    git clone https://github.com/hmasdev/simple_typing_application
    cd simple_typing_application
  3. Create your feature branch:

    git checkout -b feature/your-feature
  4. Setup your development environment (uv recommended):

    uv sync

    If you want to include optional dependencies for development (e.g., huggingface, pandas, etc.), run:

    uv sync --extra huggingface --extra extra

    To know which option is available, see ./pyproject.toml.

  5. Develop your feature and add tests.

  6. Test your feature:

    uv run pytest  # Unit test
    uv run pytest -m integrate  # integration test
  7. Check the code style and static type:

    uv run ruff check simple_typing_application
    uv run ruff check tests
    uv run mypy simple_typing_application
    uv run mypy tests

    (Optional) Format code:

    uv run ruff format simple_typing_application
    uv run ruff format tests
  8. Commit your changes:

    git add .
    git commit -m "Add your feature"
  9. Push to the branch:

    git push -u origin feature/your-feature
  10. Create a new Pull Request:

Thank you for your contribution! ๐Ÿ™

๐Ÿ“„ LICENSE

simple_typing_application is licensed under the MIT License. See the LICENSE file for more details.

๐Ÿ“š References

๐Ÿ‘จโ€๐Ÿ’ป Authors

About

Simple Typing Application

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages