Skip to content

teeschima/go-reloaded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎯 GO-RELOADED

About: My first real GOLANG project.


Objectives


    In this project, I used some of my old functions made in my repository. I used them with the objective of making a simple text completion/editing/auto-correction tool.

🚀 Introduction

My project is written in Go.

The code respects the good practices.

I have test files for unit testing.

The tool built receives as arguments the name of a file containing a text that needs some modifications (the input) and the name of the file the modified text should be placed in (the output).

List of possible modifications that my program executes:

Every instance of (hex) replaces the word before with the decimal version of the word (in this case the word will always be a hexadecimal number). (Ex: "1E (hex) files were added" -> "30 files were added")

Every instance of (bin) replaces the word before with the decimal version of the word (in this case the word will always be a binary number). (Ex: "It has been 10 (bin) years" -> "It has been 2 years")

Every instance of (up) converts the word before with the Uppercase version of it. (Ex: "Ready, set, go (up) !" -> "Ready, set, GO!")

Every instance of (low) converts the word before with the Lowercase version of it. (Ex: "I should stop SHOUTING (low)" -> "I should stop shouting")

Every instance of (cap) converts the word before with the capitalized version of it. (Ex: "Welcome to the Brooklyn bridge (cap)" -> "Welcome to the Brooklyn Bridge")

    For (low), (up), (cap) if a number appears next to it, like so: (low, <number>) it turns the previously specified number of words in lowercase, uppercase or capitalized accordingly. (Ex: "This is so exciting (up, 2)" -> "This is SO EXCITING")

Every instance of the punctuations ., ,, !, ?, : and ; is close to the previous word and with space apart from the next one. (Ex: "I was sitting over there ,and then BAMM !!" -> "I was sitting over there, and then BAMM!!").

    Except the groups of punctuation like: ... or !?. In this case the program should format the text as in the following example: "I was thinking ... You were right" -> "I was thinking... You were right".

The punctuation mark ' will always be found with another instance of it and they should be placed to the right and left of the word in the middle of them, without any spaces. (Ex: "I am exactly how they describe me: ' awesome '" -> "I am exactly how they describe me: 'awesome'")

    If there are more than one word between the two ' ' marks, the program should place the marks next to the corresponding words (Ex: "As Elton John said: ' I am the most well-known homosexual in the world '" -> "As Elton John said: 'I am the most well-known homosexual in the world'")

Every instance of a is turned into an if the next word begins with a vowel (a, e, i, o, u) or a h. (Ex: "There it was. A amazing rock!" -> "There it was. An amazing rock!").

⚙️ Installation

Version

  • Go 1.22.2

Clone the repository

git remote add origin https://acad.learn2earn.ng/git/schima/go-reloaded.git

Navigate into project

cd go-reloaded

Build the project

go build .

Usage

    $ cat sample.txt
    it (cap) was the best of times, it was the worst of times (up) , it was the age of wisdom, it was the age of foolishness (cap, 6) , it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of darkness, it was the spring of hope, IT WAS THE (low, 3) winter of despair.
    $ go run . sample.txt result.txt
    $ cat result.txt
    It was the best of times, it was the worst of TIMES, it was the age of wisdom, It Was The Age Of Foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of darkness, it was the spring of hope, it was the winter of despair.
    $ cat sample.txt
    Simply add 42 (hex) and 10 (bin) and you will see the result is 68.
    $ go run . sample.txt result.txt
    $ cat result.txt
    Simply add 66 and 2 and you will see the result is 68.
    $ cat sample.txt
    There is no greater agony than bearing a untold story inside you.
    $ go run . sample.txt result.txt
    $ cat result.txt
    There is no greater agony than bearing an untold story inside you.
    $ cat sample.txt
    Punctuation tests are ... kinda boring ,what do you think ?
    $ go run . sample.txt result.txt
    $ cat result.txt
    Punctuation tests are... kinda boring, what do you think?

📂 Project Structure

go-reloaded/ │── main.go │── sample.txt │── README.md

🤝 Contributing

Pull requests are welcome.
For major changes, please open an issue first to discuss what you would like to change.

👤 Author

    Stephen Chima  
    GitHub: https://github.com/teeschima

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages