Project

tfhelps

0.0
No release in over a year
The Helps Text Formatter gem is a command-line tool designed for Helps Ministries to clean up and format text files using the power of Google's Gemini API. It takes a .txt file as input, sends the content to the Gemini API for intelligent formatting, and saves the professionally formatted text to a new file.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

TFHelps

Gem Version

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.

Installation

Run this command to install the gem:

gem install tfhelps

Usage

Prerequisites

Before using TFHelps, you need to obtain an API key from Google's AI Studio. Follow these steps:

  1. Visit Google AI Studio and sign in with your Google account.
  2. Generate an API key (free or paid, depending on your usage needs).
  3. 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"
  1. Restart your terminal or run source ~/.bashrc (or equivalent) to apply the changes.

Running the Tool

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

Formatting Guidelines

TFHelps follows these rules to format your text:

  1. Combine sentences into a single paragraph if they are separated by a single empty line.
  2. Create a new paragraph whenever there are two or more empty lines separating the text.
  3. Ensure proper spacing, punctuation, and capitalization throughout the text.
  4. Maintain a clean and polished format suitable for professional use.

Contributing

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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Tfhelps project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.