Welcome back. Congratulations on your admission. We knew you would make it. Now it is time to get into projects.
In this project you will use some of your old functions made in your old repository. You will use them with the objective of making a simple text completion/editing/auto-correction tool.
One more detail. This time the project will be corrected by auditors. The auditors will be other students and you will be an auditor as well.
We advise you to create your own tests for yourself and for when you will correct your auditees.
The tool you are about to build will receive 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). Next is a list of possible modifications that your program should execute:
(hex) should replace 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â)(bin) should replace 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â)(up) converts the word before with the Uppercase version of it. (Ex: âReady, set, go (up) !â -> âReady, set, GO!â)(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â)
(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â)., ,, !, ?, : and ; should be 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!!â).
... 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â.' 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ââ)
' ' 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ââ)a should be 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!â).$ 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?
This project will help you learn about :