Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language Categorizer

A Python script that uses Ollama AI to automatically detect and categorize the language of text entries. This tool reads words or phrases from an input file and identifies their language using the Qwen3:4b-instruct model.

Features

  • 🌍 Automatic language detection for multiple languages (English, French, German, Spanish, Japanese, Chinese, Italian, etc.)
  • 🤖 Powered by Ollama with Qwen3:4b-instruct model
  • 📝 Batch processing of text files
  • ⚡ Fast and efficient processing
  • 📊 Clear output format showing word → language mappings

Prerequisites

  • Python 3.14 or higher
  • Ollama installed and running on your computer
  • Qwen3:4b-instruct model pulled in Ollama

Installation

  1. Clone or download this repository

  2. Install dependencies using uv:

    uv sync
  3. Make sure Ollama is running and has the Qwen3:4b-instruct model:

    ollama pull qwen3:4b-instruct

Usage

  1. Add your text entries to input.txt (one entry per line)

  2. Run the script:

    uv run main.py
  3. Check the results in output.txt

Example

Input (input.txt):

Mango
りんご
Fraise
Banane

Output (output.txt):

Mango -> English
りんご -> Japanese
Fraise -> French
Banane -> French

How It Works

The script:

  1. Reads each line from input.txt
  2. Sends each entry to Ollama using the Qwen3:4b-instruct model
  3. Receives the detected language for each entry
  4. Writes the results in word -> language format to output.txt
  5. Displays progress and total processing time in the console

Dependencies

  • ollama>=0.6.1 - Python client for Ollama AI

Project Structure

categorizer/
├── main.py           # Main script for language categorization
├── input.txt         # Input file with text entries
├── output.txt        # Output file with categorization results
├── pyproject.toml    # Project configuration and dependencies
├── README.md         # This file
└── uv.lock          # Locked dependencies

License

This project is open source and available for personal and educational use.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages