update
This commit is contained in:
parent
24314ddd69
commit
b4b05f78d3
4
.gitignore
vendored
4
.gitignore
vendored
@ -30,4 +30,6 @@
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.app
|
||||
|
||||
build/
|
91
owo.cpp
91
owo.cpp
@ -3,6 +3,7 @@
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include "clip-lib/clip.h"
|
||||
#include <random>
|
||||
using namespace std;
|
||||
|
||||
string replacements[6][2] = {
|
||||
@ -14,11 +15,76 @@ string replacements[6][2] = {
|
||||
{"ove", "uv"}
|
||||
};
|
||||
|
||||
string owo(string input) {
|
||||
string random_ending_replacents[11] = {
|
||||
"uwu",
|
||||
"owo",
|
||||
"OwO",
|
||||
"UwU",
|
||||
"uwu",
|
||||
"OwO",
|
||||
">w<",
|
||||
"Owo",
|
||||
"X3",
|
||||
":3",
|
||||
">:3",
|
||||
};
|
||||
|
||||
string full_word_replacents[20][2] = {
|
||||
{"hello", "h-hello there"},
|
||||
{"goodbye", "bai"},
|
||||
{"bye", "bai"},
|
||||
{"please", "p-pwease"},
|
||||
{"thanks", "t-thank u"},
|
||||
{"thank you", "t-thank u"},
|
||||
{"you", "u"},
|
||||
{"your", "ur"},
|
||||
{"you're", "ur"},
|
||||
{"you are", "ur"},
|
||||
{"are", "r"},
|
||||
{"the", "da"},
|
||||
{"this", "dis"},
|
||||
{"that", "dat"},
|
||||
{"there", "dere"},
|
||||
{"they", "dey"},
|
||||
{"their", "dere"},
|
||||
{"them", "dem"},
|
||||
{"those", "dose"},
|
||||
{"these", "deez"},
|
||||
};
|
||||
|
||||
string random_ending(string input) {
|
||||
string output = input;
|
||||
for (int i = 0; i < output.length(); i++) {
|
||||
if (output[i] == '.' || output[i] == '!' || output[i] == '?') {
|
||||
output.insert(i, " " + random_ending_replacents[rand() % 11]);
|
||||
i += random_ending_replacents[rand() % 11].length() + 1;
|
||||
}
|
||||
}
|
||||
if (output[output.length()-1] != '.' && output[output.length()-1] != '!' && output[output.length()-1] != '?') {
|
||||
output += " " + random_ending_replacents[rand() % 11];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
string full_word(string input) {
|
||||
string output = input;
|
||||
for (int i = 0; i < 20; i++) {
|
||||
output = regex_replace(output, regex(full_word_replacents[i][0]), full_word_replacents[i][1]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
string owo(string input, bool no_full_word = false, bool no_random_ending = false) {
|
||||
string output = input;
|
||||
if (!no_full_word){
|
||||
output = full_word(output);
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
output = regex_replace(output, regex(replacements[i][0]), replacements[i][1]);
|
||||
}
|
||||
if (!no_random_ending) {
|
||||
output = random_ending(output);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
@ -33,13 +99,16 @@ int help() {
|
||||
cout << " -f Read from file" << endl;
|
||||
cout << " -o Write to file" << endl;
|
||||
cout << " -c Copy to clipboard" << endl;
|
||||
cout << " -ne Stops extra stuff from being added to the end of sentences" << endl;
|
||||
cout << " -nf Stops full word replacements" << endl;
|
||||
cout << " text Text to convert" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
srand(time(NULL));
|
||||
string input, inputfile, outputfile;
|
||||
bool _stdin = false, clipboard = false;
|
||||
bool _stdin = false, clipboard = false, no_full_word = false, no_random_ending = false;
|
||||
|
||||
if (argc < 2) {
|
||||
cout << owo("No text provided") << endl << endl;
|
||||
@ -62,6 +131,10 @@ int main(int argc, char *argv[]) {
|
||||
input = string(argv[i]);
|
||||
} else if (string(argv[i]) == "-c") {
|
||||
clipboard = true;
|
||||
} else if (string(argv[i]) == "-ne") {
|
||||
no_random_ending = true;
|
||||
} else if (string(argv[i]) == "-nf") {
|
||||
no_full_word = true;
|
||||
} else {
|
||||
cout << owo("Invalid argument: " + string(argv[i])) << endl << endl;
|
||||
help();
|
||||
@ -88,9 +161,9 @@ int main(int argc, char *argv[]) {
|
||||
if (_stdin) {
|
||||
while (getline(cin, input)) {
|
||||
if (outputfile != "") {
|
||||
*output << owo(input) << endl;
|
||||
*output << owo(input, no_full_word, no_random_ending) << endl;
|
||||
} else {
|
||||
cout << owo(input) << endl;
|
||||
cout << owo(input, no_full_word, no_random_ending) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,21 +179,21 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
while (getline(inputstream, input)) {
|
||||
if (outputfile != "") {
|
||||
*output << owo(input) << endl;
|
||||
*output << owo(input, no_full_word, no_random_ending) << endl;
|
||||
} else {
|
||||
cout << owo(input) << endl;
|
||||
cout << owo(input, no_full_word, no_random_ending) << endl;
|
||||
}
|
||||
}
|
||||
inputstream.close();
|
||||
|
||||
} else if (input != "") {
|
||||
if (outputfile != "") {
|
||||
*output << owo(input) << endl;
|
||||
*output << owo(input, no_full_word, no_random_ending) << endl;
|
||||
} else if (clipboard) {
|
||||
clip::set_text(owo(input));
|
||||
clip::set_text(owo(input, no_full_word, no_random_ending));
|
||||
cout << owo("Copied to clipboard") << endl;
|
||||
} else {
|
||||
cout << owo(input) << endl;
|
||||
cout << owo(input, no_full_word, no_random_ending) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user