diff options
| -rw-r--r-- | CMakeLists.txt | 3 | ||||
| -rw-r--r-- | forms.txt | 200 | ||||
| -rw-r--r-- | infinite.cpp | 44 | 
3 files changed, 206 insertions, 41 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index dd0729c..1902dc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -8,10 +8,11 @@ add_subdirectory(vendor/verbly) | |||
| 8 | add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL) | 8 | add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL) | 
| 9 | 9 | ||
| 10 | find_package(PkgConfig) | 10 | find_package(PkgConfig) | 
| 11 | pkg_check_modules(sqlite3 sqlite3 REQUIRED) | 11 | pkg_check_modules(sqlite3 sqlite3>=3.8.3 REQUIRED) | 
| 12 | pkg_check_modules(GraphicsMagick GraphicsMagick++ REQUIRED) | 12 | pkg_check_modules(GraphicsMagick GraphicsMagick++ REQUIRED) | 
| 13 | 13 | ||
| 14 | include_directories(${GraphicsMagick_INCLUDE_DIRS} ${sqlite3_INCLUDE_DIR} vendor/verbly/lib vendor/libtwittercpp/src vendor/yaml-cpp/include vendor/libtwittercpp/vendor/json/src vendor/libtwittercpp/vendor/curlcpp/include) | 14 | include_directories(${GraphicsMagick_INCLUDE_DIRS} ${sqlite3_INCLUDE_DIR} vendor/verbly/lib vendor/libtwittercpp/src vendor/yaml-cpp/include vendor/libtwittercpp/vendor/json/src vendor/libtwittercpp/vendor/curlcpp/include) | 
| 15 | link_directories(${sqlite3_LIBRARY_DIRS}) | ||
| 15 | add_executable(infinite infinite.cpp color.cpp fractal.cpp matrix3x3.cpp vector3d.cpp tinyxml2.cpp triangle.cpp) | 16 | add_executable(infinite infinite.cpp color.cpp fractal.cpp matrix3x3.cpp vector3d.cpp tinyxml2.cpp triangle.cpp) | 
| 16 | set_property(TARGET infinite PROPERTY CXX_STANDARD 11) | 17 | set_property(TARGET infinite PROPERTY CXX_STANDARD 11) | 
| 17 | set_property(TARGET infinite PROPERTY CXX_STANDARD_REQUIRED ON) | 18 | set_property(TARGET infinite PROPERTY CXX_STANDARD_REQUIRED ON) | 
| diff --git a/forms.txt b/forms.txt index bd4bc02..12e1d3e 100644 --- a/forms.txt +++ b/forms.txt | |||
| @@ -1,33 +1,173 @@ | |||
| 1 | And in that moment, I could swear we were {ADJECTIVE}. | 1 | FORM | 
| 2 | In {LANGUAGE}, you don't say "I am {ADJECTIVE}", you say "{SENTENCE}" and I think that's beautiful. | 2 | And in that moment, I could swear {CLAUSE}. | 
| 3 | Do you love the color of the {NOUN}? Which one? | 3 | In {LANGUAGE}, {CLAUSE} and {CLAUSE}. | 
| 4 | You all laugh because I'm {ADJECTIVE}. I laugh because you are all {ADJECTIVE}. | 4 | Do you love the color of the {UNCOUNTABLE_NOUN}? {SENTENCE} | 
| 5 | Life begins at the end of your {NOUN}. | 5 | You all laugh because I'm {ADJECTIVAL_PHRASE}. {SENTENCE} | 
| 6 | Every new {NOUN} is a new chance to change your {NOUN}. | 6 | Life begins at {SOMETHING}. | 
| 7 | If you {VERB} people, you have no time to {VERB} them. | 7 | Every new {NOUN} is {SOMETHING}. | 
| 8 | In the end, we only regret the {PLURAL_NOUN} we didn't take. | 8 | If you {TRANSITIVE_VERB} people, {CLAUSE}. | 
| 9 | I just want to be completely {ADJECTIVE} and say that I really {VERB} you. | 9 | In the end, {CLAUSE}. | 
| 10 | Wanderlust: a very strong and {ADJECTIVE} impulse or desire to {VERB} the world. | 10 | I just want {INFINITIVAL_PHRASE} and say that {CLAUSE}. | 
| 11 | Do not go where the {NOUN} may lead; go instead where there is no {NOUN} and leave a {NOUN}. | 11 | Wanderlust: {SOMETHING}. | 
| 12 | Do not go where the {UNCOUNTABLE_NOUN} may lead. {SENTENCE} | ||
| 12 | {Verbing} isn't easy for those who {VERB}. | 13 | {Verbing} isn't easy for those who {VERB}. | 
| 13 | You build up a world of {NOUN} because your real life is {ADJECTIVE}. | 14 | You build up a world of {PLURAL_NOUN} because {CLAUSE}. | 
| 14 | {Adjective} is just a setting on a washing machine. | 15 | {Adjective} is just {SOMETHING}. | 
| 15 | Find a beautiful {NOUN} and get {VERBED}. | 16 | Find a beautiful {NOUN} and get {VERBED}. | 
| 16 | Keep your feet on the {NOUN} when your head's in the {NOUN}. | 17 | Keep your feet on the {UNCOUNTABLE_NOUN} when your head's in the {UNCOUNTABLE_NOUN}. | 
| 17 | {Noun} can be found in the darkest of times if one only remembers to switch on the {NOUN}. | 18 | {Uncountable_noun} can be found in the {SUPERLATIVE} of times if {CLAUSE}. | 
| 18 | May the odds be ever in your {NOUN}. | 19 | May the {UNCOUNTABLE_NOUN} be ever in your {THING_YOU_HAVE}. | 
| 19 | Do something today that your future self will {VERB} you for. | 20 | Do something today that your future self will {TRANSITIVE_VERB} you for. | 
| 20 | Sometimes it's so {ADJECTIVE} to see the good {PLURAL_NOUN} passing by. | 21 | Sometimes it's so {ADJECTIVE} {INFINITIVAL_PHRASE}. | 
| 21 | When it rains, look for {PLURAL_NOUN}. When it's dark, look for {PLURAL_NOUN}. | 22 | When it rains, {CLAUSE}. {SENTENCE} | 
| 22 | I'd rather {VERB} the {NOUN} than wait for it. | 23 | I'd rather {TRANSITIVE_VERB} the {UNCOUNTABLE_NOUN} than wait for it. | 
| 23 | There's a {NOUN} in all of us. | 24 | There's a {NOUN} in all of us. | 
| 24 | You were born to be {ADJECTIVE}, not to be perfect. | 25 | You were born {INFINITIVAL_PHRASE}, not to be perfect. | 
| 25 | {Verb} me when I least deserve it because that's when I really need it. | 26 | {Transitive_verb} me when I least deserve it because {CLAUSE}. | 
| 26 | Normal is {ADJECTIVE}. | 27 | Normal is {ADJECTIVAL_PHRASE}. | 
| 27 | If nobody {VERBS} you, you're doing something wrong. | 28 | If nobody {VERBS} you, {CLAUSE}. | 
| 28 | Don't waste your whole {NOUN} trying to get back what was {VERBED}. | 29 | Don't waste your whole {THING_YOU_HAVE} trying {INFINITIVAL_PHRASE}. | 
| 29 | I can't explain how {ADJECTIVE} it is to wait for something that never {VERBS}. | 30 | I can't explain how {ADJECTIVE} it is {INFINITIVAL_PHRASE}. | 
| 30 | I will follow you into the {NOUN}. | 31 | I will follow you into the {UNCOUNTABLE_NOUN}. | 
| 31 | I think about {NOUN} a lot. More than I probably should. | 32 | I think about {NOUN} a lot. {SENTENCE} | 
| 32 | {Noun}ophobia: (n.) the fear of {VERBING} someone you love. | 33 | {Noun}ophobia: (n.) the fear of {VERBING} {SOMETHING}. | 
| 33 | We stopped looking for {PLURAL_NOUN} under our {PLURAL_NOUN} when we realized they were inside of us. \ No newline at end of file | 34 | We stopped looking for {PLURAL_NOUN} under our {PLURAL_NOUN} when we realized {CLAUSE}. | 
| 35 | Living on Earth is {ADJECTIVE}, but {CLAUSE}. | ||
| 36 | We are all {PLURAL_NOUN} wanting {INFINITIVAL_PHRASE}. | ||
| 37 | Let's not try {INFINITIVAL_PHRASE}. | ||
| 38 | I'm going {INFINITIVAL_PHRASE} because {CLAUSE}. | ||
| 39 | A dream is {SOMETHING} your {THING_YOU_HAVE} makes. | ||
| 40 | All {PLURAL_NOUN} have {SOMETHING}. | ||
| 41 | After {SOMETHING}, my {THING_YOU_HAVE} said "{SENTENCE}" | ||
| 42 | |||
| 43 | CLAUSE | ||
| 44 | we were {ADJECTIVAL_PHRASE} | ||
| 45 | you don't say "I am {ADJECTIVE}", you say "{VERBLY_SENTENCE}" | ||
| 46 | I think that's beautiful | ||
| 47 | you have no time {INFINITIVAL_PHRASE} | ||
| 48 | we only regret the {PLURAL_NOUN} we didn't take | ||
| 49 | I really {TRANSITIVE_VERB} you | ||
| 50 | your real life is {ADJECTIVAL_PHRASE} | ||
| 51 | you remember {INFINITIVAL_PHRASE} | ||
| 52 | you should look for {PLURAL_NOUN} | ||
| 53 | that's when I really need it | ||
| 54 | you're doing something wrong | ||
| 55 | they were inside of us | ||
| 56 | it does include {SOMETHING} | ||
| 57 | I'm crazy enough {INFINITIVAL_PHRASE} | ||
| 58 | |||
| 59 | SENTENCE | ||
| 60 | Which one? | ||
| 61 | {CLAUSE}. | ||
| 62 | {FORM} | ||
| 63 | I laugh because you are all {ADJECTIVAL_PHRASE}. | ||
| 64 | Go instead where there is no {NOUN} and leave a {NOUN}. | ||
| 65 | When it's dark, {CLAUSE}. | ||
| 66 | More than I probably should. | ||
| 67 | Maybe life isn't for everyone. | ||
| 68 | |||
| 69 | SOMETHING | ||
| 70 | the end of your {THING_YOU_HAVE} | ||
| 71 | a new chance {INFINITIVAL_PHRASE} | ||
| 72 | a very strong and {ADJECTIVE} impulse or desire {INFINITIVAL_PHRASE} | ||
| 73 | a setting on a washing machine | ||
| 74 | someone you love | ||
| 75 | a free trip around the sun | ||
| 76 | everything | ||
| 77 | a wish | ||
| 78 | an end | ||
| 79 | a year in therapy | ||
| 80 | |||
| 81 | INFINITIVAL_PHRASE | ||
| 82 | to be {ADJECTIVAL_PHRASE} | ||
| 83 | to get back what was {VERBED} | ||
| 84 | to wait for something that never {VERBS} | ||
| 85 | to be completely upfront | ||
| 86 | to see the good {PLURAL_NOUN} passing by | ||
| 87 | to {TRANSITIVE_VERB} them | ||
| 88 | to switch on the {UNCOUNTABLE_NOUN} | ||
| 89 | to change your {THING_YOU_HAVE} | ||
| 90 | to {TRANSITIVE_VERB} the {UNCOUNTABLE_NOUN} | ||
| 91 | to be completely out of touch with reality | ||
| 92 | to figure out {SOMETHING} at once | ||
| 93 | to succeed | ||
| 94 | to think I can | ||
| 95 | |||
| 96 | ADJECTIVAL_PHRASE | ||
| 97 | {ADJECTIVE} | ||
| 98 | {ADJECTIVE} | ||
| 99 | {ADJECTIVE} | ||
| 100 | {ADJECTIVE} | ||
| 101 | {ADJECTIVE} | ||
| 102 | the same | ||
| 103 | getting fucked | ||
| 104 | getting {VERBED} | ||
| 105 | |||
| 106 | ADJECTIVE | ||
| 107 | infinite | ||
| 108 | different | ||
| 109 | irresistable | ||
| 110 | sexual | ||
| 111 | unhappy | ||
| 112 | stupid | ||
| 113 | gay | ||
| 114 | high | ||
| 115 | expensive | ||
| 116 | beautiful | ||
| 117 | opulent | ||
| 118 | salacious | ||
| 119 | destined | ||
| 120 | surreal | ||
| 121 | indecent | ||
| 122 | |||
| 123 | UNCOUNTABLE_NOUN | ||
| 124 | sky | ||
| 125 | road | ||
| 126 | ground | ||
| 127 | clouds | ||
| 128 | light | ||
| 129 | happiness | ||
| 130 | serenity | ||
| 131 | desirability | ||
| 132 | misfortune | ||
| 133 | wealth | ||
| 134 | {ADJECTIVE} inadequacy | ||
| 135 | odds | ||
| 136 | |||
| 137 | THING_YOU_HAVE | ||
| 138 | fears | ||
| 139 | life | ||
| 140 | favor | ||
| 141 | heart | ||
| 142 | therapist | ||
| 143 | hopes | ||
| 144 | love | ||
| 145 | Amazon Prime subscription | ||
| 146 | |||
| 147 | PLURAL_NOUN | ||
| 148 | risks | ||
| 149 | lies | ||
| 150 | mistakes | ||
| 151 | dreamers | ||
| 152 | stories | ||
| 153 | hopes | ||
| 154 | queers | ||
| 155 | lives | ||
| 156 | needs | ||
| 157 | experiences | ||
| 158 | freedoms | ||
| 159 | |||
| 160 | TRANSITIVE_VERB | ||
| 161 | destroy | ||
| 162 | kill | ||
| 163 | hate | ||
| 164 | love | ||
| 165 | fight | ||
| 166 | report | ||
| 167 | represent | ||
| 168 | revile | ||
| 169 | exhume | ||
| 170 | inter | ||
| 171 | disgrace | ||
| 172 | eat | ||
| 173 | butter \ No newline at end of file | ||
| diff --git a/infinite.cpp b/infinite.cpp index 22de917..f79d201 100644 --- a/infinite.cpp +++ b/infinite.cpp | |||
| @@ -433,6 +433,8 @@ class fill_blanks { | |||
| 433 | int main(int argc, char** argv) | 433 | int main(int argc, char** argv) | 
| 434 | { | 434 | { | 
| 435 | srand(time(NULL)); | 435 | srand(time(NULL)); | 
| 436 | rand(); rand(); rand(); rand(); | ||
| 437 | |||
| 436 | Magick::InitializeMagick(nullptr); | 438 | Magick::InitializeMagick(nullptr); | 
| 437 | 439 | ||
| 438 | int delay = 60 * 60; | 440 | int delay = 60 * 60; | 
| @@ -450,15 +452,17 @@ int main(int argc, char** argv) | |||
| 450 | { | 452 | { | 
| 451 | std::cout << "Generating text..." << std::endl; | 453 | std::cout << "Generating text..." << std::endl; | 
| 452 | 454 | ||
| 453 | std::vector<std::string> forms; | 455 | std::map<std::string, std::vector<std::string>> groups; | 
| 454 | std::ifstream datafile("forms.txt"); | 456 | std::ifstream datafile("forms.txt"); | 
| 455 | if (!datafile.is_open()) | 457 | if (!datafile.is_open()) | 
| 456 | { | 458 | { | 
| 457 | std::cout << "Could not find forms.txt" << std::endl; | 459 | std::cout << "Could not find forms.txt" << std::endl; | 
| 458 | return 1; | 460 | return 1; | 
| 459 | } | 461 | } | 
| 460 | 462 | ||
| 463 | bool newgroup = true; | ||
| 461 | std::string line; | 464 | std::string line; | 
| 465 | std::string curgroup; | ||
| 462 | while (getline(datafile, line)) | 466 | while (getline(datafile, line)) | 
| 463 | { | 467 | { | 
| 464 | if (line.back() == '\r') | 468 | if (line.back() == '\r') | 
| @@ -466,13 +470,24 @@ int main(int argc, char** argv) | |||
| 466 | line.pop_back(); | 470 | line.pop_back(); | 
| 467 | } | 471 | } | 
| 468 | 472 | ||
| 469 | forms.push_back(line); | 473 | if (newgroup) | 
| 474 | { | ||
| 475 | curgroup = line; | ||
| 476 | newgroup = false; | ||
| 477 | } else { | ||
| 478 | if (line.empty()) | ||
| 479 | { | ||
| 480 | newgroup = true; | ||
| 481 | } else { | ||
| 482 | groups[curgroup].push_back(line); | ||
| 483 | } | ||
| 484 | } | ||
| 470 | } | 485 | } | 
| 471 | 486 | ||
| 472 | datafile.close(); | 487 | datafile.close(); | 
| 473 | 488 | ||
| 474 | verbly::data database {"data.sqlite3"}; | 489 | verbly::data database {"data.sqlite3"}; | 
| 475 | std::string action = forms[rand() % forms.size()]; | 490 | std::string action = "{FORM}"; | 
| 476 | int tknloc; | 491 | int tknloc; | 
| 477 | while ((tknloc = action.find("{")) != std::string::npos) | 492 | while ((tknloc = action.find("{")) != std::string::npos) | 
| 478 | { | 493 | { | 
| @@ -487,12 +502,15 @@ int main(int argc, char** argv) | |||
| 487 | if (canontkn == "NOUN") | 502 | if (canontkn == "NOUN") | 
| 488 | { | 503 | { | 
| 489 | result = database.nouns().is_not_proper().random().limit(1).with_complexity(1).run().front().singular_form(); | 504 | result = database.nouns().is_not_proper().random().limit(1).with_complexity(1).run().front().singular_form(); | 
| 490 | } else if (canontkn == "PLURAL_NOUN") | 505 | // } else if (canontkn == "PLURAL_NOUN") | 
| 491 | { | 506 | // { | 
| 492 | result = database.nouns().is_not_proper().requires_plural_form().random().limit(1).with_complexity(1).run().front().plural_form(); | 507 | // result = database.nouns().is_not_proper().requires_plural_form().random().limit(1).with_complexity(1).run().front().plural_form(); | 
| 493 | } else if (canontkn == "ADJECTIVE") | 508 | // } else if (canontkn == "ADJECTIVE") | 
| 509 | // { | ||
| 510 | // result = database.adjectives().with_complexity(1).random().limit(1).run().front().base_form(); | ||
| 511 | } else if (canontkn == "SUPERLATIVE") | ||
| 494 | { | 512 | { | 
| 495 | result = database.adjectives().with_complexity(1).random().limit(1).run().front().base_form(); | 513 | result = database.adjectives().requires_superlative_form().random().limit(1).run().front().superlative_form(); | 
| 496 | } else if (canontkn == "VERB") | 514 | } else if (canontkn == "VERB") | 
| 497 | { | 515 | { | 
| 498 | result = database.verbs().random().limit(1).run().front().infinitive_form(); | 516 | result = database.verbs().random().limit(1).run().front().infinitive_form(); | 
| @@ -520,7 +538,7 @@ int main(int argc, char** argv) | |||
| 520 | } else if (canontkn == "ADVERB") | 538 | } else if (canontkn == "ADVERB") | 
| 521 | { | 539 | { | 
| 522 | result = database.adverbs().with_complexity(1).random().limit(1).run().front().base_form(); | 540 | result = database.adverbs().with_complexity(1).random().limit(1).run().front().base_form(); | 
| 523 | } else if (canontkn == "SENTENCE") | 541 | } else if (canontkn == "VERBLY_SENTENCE") | 
| 524 | { | 542 | { | 
| 525 | fill_blanks yeah {database}; | 543 | fill_blanks yeah {database}; | 
| 526 | verbly::token action{ | 544 | verbly::token action{ | 
| @@ -532,6 +550,10 @@ int main(int argc, char** argv) | |||
| 532 | yeah.visit(action); | 550 | yeah.visit(action); | 
| 533 | } | 551 | } | 
| 534 | result = action.compile(); | 552 | result = action.compile(); | 
| 553 | } else { | ||
| 554 | auto group = groups[canontkn]; | ||
| 555 | result = group[rand() % group.size()]; | ||
| 556 | std::cout << canontkn << ": " << group.size() << std::endl; | ||
| 535 | } | 557 | } | 
| 536 | 558 | ||
| 537 | std::string finalresult; | 559 | std::string finalresult; | 
| @@ -555,6 +577,8 @@ int main(int argc, char** argv) | |||
| 555 | 577 | ||
| 556 | action.replace(tknloc, action.find("}")-tknloc+1, finalresult); | 578 | action.replace(tknloc, action.find("}")-tknloc+1, finalresult); | 
| 557 | } | 579 | } | 
| 580 | |||
| 581 | std::cout << action << std::endl; | ||
| 558 | 582 | ||
| 559 | double zoom = 2.0; | 583 | double zoom = 2.0; | 
| 560 | double target_w = 1280; | 584 | double target_w = 1280; | 
