https://github.com/pmzi/wordsmith
WordSmith is a powerful CLI tool that leverages OpenAI's API to translate words, phrases, and sentences. It supports context-aware translations, batch processing from files, and customizable target languages, making it an essential tool for multilingual communication and language learning.
https://github.com/pmzi/wordsmith
cli-app dictionary open-ai ruby
Last synced: 4 months ago
JSON representation
WordSmith is a powerful CLI tool that leverages OpenAI's API to translate words, phrases, and sentences. It supports context-aware translations, batch processing from files, and customizable target languages, making it an essential tool for multilingual communication and language learning.
- Host: GitHub
- URL: https://github.com/pmzi/wordsmith
- Owner: pmzi
- License: mit
- Created: 2024-09-11T01:43:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-13T07:16:10.000Z (almost 2 years ago)
- Last Synced: 2025-04-05T06:41:24.669Z (about 1 year ago)
- Topics: cli-app, dictionary, open-ai, ruby
- Language: Ruby
- Homepage:
- Size: 815 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordSmith
WordSmith is a command-line tool for translating words, phrases, and words in context of a sentence.

## Features
- Translate single words or phrases
- Translate words within the context of a sentence
- Read words from a file for batch translation
- Optional caching for faster repeated translations
- Specify target language for translations
## Installation
1. Ensure you have Ruby installed on your system (version 2.7 or higher recommended).
2. Install the WordSmith gem:
```
gem install word_smith
```
3. Set up your OpenAI API key and Organization ID:
```
ws --set-openai-api-key YOUR_API_KEY
ws --set-openai-org-id YOUR_ORG_ID
```
Replace `YOUR_API_KEY` and `YOUR_ORG_ID` with your actual OpenAI credentials.
## Usage
Basic usage:
```
ws [word/phrase] [options]
```
Examples:
1. Translate a single word:
```
ws hello
```
2. Translate a phrase:
```
ws good morning
```
3. Translate a word in context:
```
ws a /random/ sentence
```
4. Translate words from a file:
```
ws -f words.txt
```
5. Translate to a specific language:
```
ws hello --target-language Spanish
```
6. Translate without using cache:
```
ws hello --no-cache
```
Options:
- `-f, --file [FILE_PATH]`: Read words from a file
- `--target-language [LANGUAGE_CODE]`: Specify target language for translation
- `--no-cache`: Translate without using cache
- `-h, --help`: Show help
- `-v, --version`: Show version
## Configuration
Set OpenAI API key:
```
ws --set-openai-api-key [key]
```
Set OpenAI Organization ID:
```
ws --set-openai-org-id [key]
```
## License
MIT