A Python library for working with language within the context of Machine Translation (MT).
This package depends on Python version 3.10, or higher.
- Translation direction: Work with language pairs for MT tasks
- Language detection: Detect languages using pycld2 and gcld3
pip install techiaith-language
from techiaith.language import LanguagePair
# Create a language pair
langs = LanguagePair.fromstring("en-cy")
print(langs.source) # "en"
print(langs.target) # "cy"
# Detect language
from techiaith.language import detect
result = detect("Hello, how are you?")
print(result)
Full documentation is available in multiple languages:
- English Documentation - docs/en/docs/index.md
- Dogfennaeth Cymraeg - docs/cy/docs/index.md
To view the documentation locally:
uv run python scripts/docs.py serve
Documentation will be available at http://0.0.0.0:8008
See the full documentation for detailed development instructions.
Quick setup:
# Install uv
# See: https://docs.astral.sh/uv/getting-started/installation/
# Clone and setup
git clone https://github.com/techiaith/language techiaith-language
cd techiaith-language
# Install all dependencies
uv sync --all-extras
# Run tests
uv run pytest
Contributions are welcome! Please see the documentation for development guidelines.
MIT License - See LICENSE file for details.