summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--forms.txt200
-rw-r--r--infinite.cpp44
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)
8add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL) 8add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL)
9 9
10find_package(PkgConfig) 10find_package(PkgConfig)
11pkg_check_modules(sqlite3 sqlite3 REQUIRED) 11pkg_check_modules(sqlite3 sqlite3>=3.8.3 REQUIRED)
12pkg_check_modules(GraphicsMagick GraphicsMagick++ REQUIRED) 12pkg_check_modules(GraphicsMagick GraphicsMagick++ REQUIRED)
13 13
14include_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) 14include_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)
15link_directories(${sqlite3_LIBRARY_DIRS})
15add_executable(infinite infinite.cpp color.cpp fractal.cpp matrix3x3.cpp vector3d.cpp tinyxml2.cpp triangle.cpp) 16add_executable(infinite infinite.cpp color.cpp fractal.cpp matrix3x3.cpp vector3d.cpp tinyxml2.cpp triangle.cpp)
16set_property(TARGET infinite PROPERTY CXX_STANDARD 11) 17set_property(TARGET infinite PROPERTY CXX_STANDARD 11)
17set_property(TARGET infinite PROPERTY CXX_STANDARD_REQUIRED ON) 18set_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 @@
1And in that moment, I could swear we were {ADJECTIVE}. 1FORM
2In {LANGUAGE}, you don't say "I am {ADJECTIVE}", you say "{SENTENCE}" and I think that's beautiful. 2And in that moment, I could swear {CLAUSE}.
3Do you love the color of the {NOUN}? Which one? 3In {LANGUAGE}, {CLAUSE} and {CLAUSE}.
4You all laugh because I'm {ADJECTIVE}. I laugh because you are all {ADJECTIVE}. 4Do you love the color of the {UNCOUNTABLE_NOUN}? {SENTENCE}
5Life begins at the end of your {NOUN}. 5You all laugh because I'm {ADJECTIVAL_PHRASE}. {SENTENCE}
6Every new {NOUN} is a new chance to change your {NOUN}. 6Life begins at {SOMETHING}.
7If you {VERB} people, you have no time to {VERB} them. 7Every new {NOUN} is {SOMETHING}.
8In the end, we only regret the {PLURAL_NOUN} we didn't take. 8If you {TRANSITIVE_VERB} people, {CLAUSE}.
9I just want to be completely {ADJECTIVE} and say that I really {VERB} you. 9In the end, {CLAUSE}.
10Wanderlust: a very strong and {ADJECTIVE} impulse or desire to {VERB} the world. 10I just want {INFINITIVAL_PHRASE} and say that {CLAUSE}.
11Do not go where the {NOUN} may lead; go instead where there is no {NOUN} and leave a {NOUN}. 11Wanderlust: {SOMETHING}.
12Do 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}.
13You build up a world of {NOUN} because your real life is {ADJECTIVE}. 14You build up a world of {PLURAL_NOUN} because {CLAUSE}.
14{Adjective} is just a setting on a washing machine. 15{Adjective} is just {SOMETHING}.
15Find a beautiful {NOUN} and get {VERBED}. 16Find a beautiful {NOUN} and get {VERBED}.
16Keep your feet on the {NOUN} when your head's in the {NOUN}. 17Keep 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}.
18May the odds be ever in your {NOUN}. 19May the {UNCOUNTABLE_NOUN} be ever in your {THING_YOU_HAVE}.
19Do something today that your future self will {VERB} you for. 20Do something today that your future self will {TRANSITIVE_VERB} you for.
20Sometimes it's so {ADJECTIVE} to see the good {PLURAL_NOUN} passing by. 21Sometimes it's so {ADJECTIVE} {INFINITIVAL_PHRASE}.
21When it rains, look for {PLURAL_NOUN}. When it's dark, look for {PLURAL_NOUN}. 22When it rains, {CLAUSE}. {SENTENCE}
22I'd rather {VERB} the {NOUN} than wait for it. 23I'd rather {TRANSITIVE_VERB} the {UNCOUNTABLE_NOUN} than wait for it.
23There's a {NOUN} in all of us. 24There's a {NOUN} in all of us.
24You were born to be {ADJECTIVE}, not to be perfect. 25You 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}.
26Normal is {ADJECTIVE}. 27Normal is {ADJECTIVAL_PHRASE}.
27If nobody {VERBS} you, you're doing something wrong. 28If nobody {VERBS} you, {CLAUSE}.
28Don't waste your whole {NOUN} trying to get back what was {VERBED}. 29Don't waste your whole {THING_YOU_HAVE} trying {INFINITIVAL_PHRASE}.
29I can't explain how {ADJECTIVE} it is to wait for something that never {VERBS}. 30I can't explain how {ADJECTIVE} it is {INFINITIVAL_PHRASE}.
30I will follow you into the {NOUN}. 31I will follow you into the {UNCOUNTABLE_NOUN}.
31I think about {NOUN} a lot. More than I probably should. 32I 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}.
33We stopped looking for {PLURAL_NOUN} under our {PLURAL_NOUN} when we realized they were inside of us. \ No newline at end of file 34We stopped looking for {PLURAL_NOUN} under our {PLURAL_NOUN} when we realized {CLAUSE}.
35Living on Earth is {ADJECTIVE}, but {CLAUSE}.
36We are all {PLURAL_NOUN} wanting {INFINITIVAL_PHRASE}.
37Let's not try {INFINITIVAL_PHRASE}.
38I'm going {INFINITIVAL_PHRASE} because {CLAUSE}.
39A dream is {SOMETHING} your {THING_YOU_HAVE} makes.
40All {PLURAL_NOUN} have {SOMETHING}.
41After {SOMETHING}, my {THING_YOU_HAVE} said "{SENTENCE}"
42
43CLAUSE
44we were {ADJECTIVAL_PHRASE}
45you don't say "I am {ADJECTIVE}", you say "{VERBLY_SENTENCE}"
46I think that's beautiful
47you have no time {INFINITIVAL_PHRASE}
48we only regret the {PLURAL_NOUN} we didn't take
49I really {TRANSITIVE_VERB} you
50your real life is {ADJECTIVAL_PHRASE}
51you remember {INFINITIVAL_PHRASE}
52you should look for {PLURAL_NOUN}
53that's when I really need it
54you're doing something wrong
55they were inside of us
56it does include {SOMETHING}
57I'm crazy enough {INFINITIVAL_PHRASE}
58
59SENTENCE
60Which one?
61{CLAUSE}.
62{FORM}
63I laugh because you are all {ADJECTIVAL_PHRASE}.
64Go instead where there is no {NOUN} and leave a {NOUN}.
65When it's dark, {CLAUSE}.
66More than I probably should.
67Maybe life isn't for everyone.
68
69SOMETHING
70the end of your {THING_YOU_HAVE}
71a new chance {INFINITIVAL_PHRASE}
72a very strong and {ADJECTIVE} impulse or desire {INFINITIVAL_PHRASE}
73a setting on a washing machine
74someone you love
75a free trip around the sun
76everything
77a wish
78an end
79a year in therapy
80
81INFINITIVAL_PHRASE
82to be {ADJECTIVAL_PHRASE}
83to get back what was {VERBED}
84to wait for something that never {VERBS}
85to be completely upfront
86to see the good {PLURAL_NOUN} passing by
87to {TRANSITIVE_VERB} them
88to switch on the {UNCOUNTABLE_NOUN}
89to change your {THING_YOU_HAVE}
90to {TRANSITIVE_VERB} the {UNCOUNTABLE_NOUN}
91to be completely out of touch with reality
92to figure out {SOMETHING} at once
93to succeed
94to think I can
95
96ADJECTIVAL_PHRASE
97{ADJECTIVE}
98{ADJECTIVE}
99{ADJECTIVE}
100{ADJECTIVE}
101{ADJECTIVE}
102the same
103getting fucked
104getting {VERBED}
105
106ADJECTIVE
107infinite
108different
109irresistable
110sexual
111unhappy
112stupid
113gay
114high
115expensive
116beautiful
117opulent
118salacious
119destined
120surreal
121indecent
122
123UNCOUNTABLE_NOUN
124sky
125road
126ground
127clouds
128light
129happiness
130serenity
131desirability
132misfortune
133wealth
134{ADJECTIVE} inadequacy
135odds
136
137THING_YOU_HAVE
138fears
139life
140favor
141heart
142therapist
143hopes
144love
145Amazon Prime subscription
146
147PLURAL_NOUN
148risks
149lies
150mistakes
151dreamers
152stories
153hopes
154queers
155lives
156needs
157experiences
158freedoms
159
160TRANSITIVE_VERB
161destroy
162kill
163hate
164love
165fight
166report
167represent
168revile
169exhume
170inter
171disgrace
172eat
173butter \ 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 {
433int main(int argc, char** argv) 433int 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;