transword-matcher
A Python package that uses structured pattern matching to interpret user requests for language translation, extracting the source and target languages along with the text to translate. It returns a detailed, organized response including the translated text, original text, and detected source and target languages.
Installation
pip install transword_matcher
Usage
from transword_matcher import transword_matcher
# Example usage with default LLM (ChatLLM7)
response = transword_matcher(
user_input="Translate 'hello' from English to Spanish"
)
print(response)
Using a Custom LLM
You can pass your own LangChain-compatible LLM instance:
from langchain_openai import ChatOpenAI
from transword_matcher import transword_matcher
llm = ChatOpenAI()
response = transword_matcher(
user_input="Translate this text to French",
llm=llm
)
from langchain_anthropic import ChatAnthropic
from transword_matcher import transword_matcher
llm = ChatAnthropic()
response = transword_matcher(
user_input="How do you say 'thank you' in Japanese?",
llm=llm
)
from langchain_google_genai import ChatGoogleGenerativeAI
from transword_matcher import transword_matcher
llm = ChatGoogleGenerativeAI()
response = transword_matcher(
user_input="Translate from German to English: 'Guten Tag'",
llm=llm
)
Using Custom API Key
from transword_matcher import transword_matcher
response = transword_matcher(
user_input="Translate to Italian",
api_key="your_llm7_api_key_here"
)
Parameters
user_input(str): The user input text to processllm(Optional[BaseChatModel]): LangChain LLM instance (defaults to ChatLLM7)api_key(Optional[str]): API key for LLM7 service (if using default LLM)
Default LLM
The package uses ChatLLM7 from langchain_llm7 by default. The free tier rate limits are sufficient for most use cases.
To get a free API key for LLM7, register at: https://token.llm7.io/
Error Handling
The function raises a RuntimeError if the LLM call fails or pattern matching is unsuccessful.
Development
Issues and contributions welcome at: https://github.com/chigwell/transword-matcher
Author
Eugene Evstafev
hi@euegne.plus
Metadata
Release files for transword-matcher 2025.12.21084344
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| transword_matcher-2025.12.21084344.tar.gz | 4.7 kB | Without provenance | Details for transword_matcher-2025.12.21084344.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| transword_matcher-2025.12.21084344-py3-none-any.whl | Python 3 | none | any | Details for transword_matcher-2025.12.21084344-py3-none-any.whl |
Total release size: 10.0 kB
Release files / transword_matcher-2025.12.21084344.tar.gz
| Download URL | transword_matcher-2025.12.21084344.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34efea6055d4671f248ec88be4cd68d96cd292449eb462a30ebfae5114f76a75
|
|
BLAKE2b-256 checksum How to use checksums |
1a5c5486c738d02d05e06a0ec589fcc3ac2443bbc0acfb54e27a3b22f011fd13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / transword_matcher-2025.12.21084344-py3-none-any.whl
| Download URL | transword_matcher-2025.12.21084344-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb60c6e5e046aa1713f6ccf5fa1fb7b6516ed42f723612f2d203bdb4917ff058
|
|
BLAKE2b-256 checksum How to use checksums |
97bbc4f1aa8818ecbffa8ea755ea8a9597326b9ad95f76ee0fea0ab14c43da66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Security for transword-matcher 2025.12.21084344
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.