TFHelps is a command-line tool designed to format text files professionally and efficiently. Built primarily for Helps Ministries, it uses the Gemini API to clean up and structure text based on predefined formatting guidelines. This tool is ideal for anyone looking to automate the process of making text more readable and polished.
Run this command to install the gem:
gem install tfhelps
Before using TFHelps, you need to obtain an API key from Google's AI Studio. Follow these steps:
- Visit Google AI Studio and sign in with your Google account.
- Generate an API key (free or paid, depending on your usage needs).
- Store the API key in your environment variables with the key GEMINI_API_KEY. To achieve that, add the following line to your .bashrc, .zshrc, or equivalent shell configuration file:
export GEMINI_API_KEY="your_api_key_here"
- Restart your terminal or run
source ~/.bashrc
(or equivalent) to apply the changes.
Process a single text file:
tfhelps path/to/your/textfile.txt
Output: Overwrites textfile.txt with the formatted content
Process all .txt files in a directory:
tfhelps path/to/your/text_files/
Creates an output/
directory with formatted versions of all files
Custom output directory (optional):
tfhelps path/to/files/ --output-dir custom_output
TFHelps follows these rules to format your text:
- Combine sentences into a single paragraph if they are separated by a single empty line.
- Create a new paragraph whenever there are two or more empty lines separating the text.
- Ensure proper spacing, punctuation, and capitalization throughout the text.
- Maintain a clean and polished format suitable for professional use.
Bug reports and pull requests are welcome on GitHub at https://github.com/wuletawwonte/tfhelps. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Tfhelps project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.