Updates to correct major issues

This commit is contained in:
William Moore 2024-08-07 13:11:25 -05:00
parent cca46afd7d
commit 249b0b5119

207
splork.el
View File

@ -15,6 +15,10 @@
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
(defun sentence-case (sentence)
(format "%s%s" (upcase (substring sentence 0 1)) (substring sentence 1))
)
(defun find-pos (words pos excludeProper)
"Find the Part of Speech from the array"
(setq new-words (delq nil (mapcar (lambda (x) (and (equal pos (nth 1 x)) x)) words)))
@ -36,7 +40,10 @@
(setq new-words (delq nil (mapcar (lambda (x) (and (equal "NOUN" (nth 1 x)) x)) words)))
(setq word (nth (random (length new-words)) new-words))
(if (equal "PROPER" (nth 2 word))
(if (string-match-p "PROPER" (nth 2 word))
(nth 0 word)
)
(if (string-match-p "PLACE" (nth 2 word))
(nth 0 word)
(format "the %s" (nth 0 word))
)
@ -54,7 +61,7 @@
("chilli" "NOUN" "")
("snoo-snoo" "VERB" "ACTION")
("Big Lie" "NOUN" "")
("Nerderium" "NOUN" "PLACE|PROPER")
("Nerderium" "NOUN" "PLACE")
("Dungeons & Dragons" "NOUN" "")
("your" "PRONOUN" "")
("their" "PRONOUN" "")
@ -178,47 +185,47 @@
("deals with" "PREPOSITION" "")
("avoids servants of" "PREPOSITION" "")
("assumes responsibility for" "PREPOSITION" "")
("the End Zone" "NOUN" "PLACE|PROPER")
("Springfield" "NOUN" "PLACE|PROPER")
("the United States of America" "NOUN" "PLACE|PROPER")
("Germany" "NOUN" "PLACE|PROPER")
("Eldaraenth" "NOUN" "PLACE|PROPER")
("Dorkish Treehouse" "NOUN" "PLACE|PROPER")
("Taberna Faecvm" "NOUN" "PLACE|PROPER")
("Alabama" "NOUN" "PLACE|PROPER")
("Washington, D.C." "NOUN" "PLACE|PROPER")
("the World Trade Center" "NOUN" "PLACE|PROPER")
("the Pentagon" "NOUN" "PLACE|PROPER")
("New York" "NOUN" "PLACE|PROPER")
("Middle Earth" "NOUN" "PLACE|PROPER")
("the Shire" "NOUN" "PLACE|PROPER")
("Smallville" "NOUN" "PLACE|PROPER")
("beautiful downtown Burbank" "NOUN" "PLACE|PROPER")
("the Death Star" "NOUN" "PLACE|PROPER")
("Yrth" "NOUN" "PLACE|PROPER")
("your place" "NOUN" "PLACE|PROPER")
("the End Zone" "NOUN" "PLACE")
("Springfield" "NOUN" "PLACE")
("the United States of America" "NOUN" "PLACE")
("Germany" "NOUN" "PLACE")
("Eldaraenth" "NOUN" "PLACE")
("Dorkish Treehouse" "NOUN" "PLACE")
("Taberna Faecvm" "NOUN" "PLACE")
("Alabama" "NOUN" "PLACE")
("Washington, D.C." "NOUN" "PLACE")
("the World Trade Center" "NOUN" "PLACE")
("the Pentagon" "NOUN" "PLACE")
("New York" "NOUN" "PLACE")
("Middle Earth" "NOUN" "PLACE")
("the Shire" "NOUN" "PLACE")
("Smallville" "NOUN" "PLACE")
("beautiful downtown Burbank" "NOUN" "PLACE")
("the Death Star" "NOUN" "PLACE")
("Yrth" "NOUN" "PLACE")
("your place" "NOUN" "PLACE")
("you-know-where" "NOUN" "PLACE")
("Wall Street" "NOUN" "PLACE|PROPER")
("Uranus" "NOUN" "PLACE|PROPER")
("Topeka" "NOUN" "PLACE|PROPER")
("Toledo" "NOUN" "PLACE|PROPER")
("the White House" "NOUN" "PLACE|PROPER")
("the Watergate Hotel" "NOUN" "PLACE|PROPER")
("the Vatican" "NOUN" "PLACE|PROPER")
("the U.S. Attorney's Office" "NOUN" "PLACE|PROPER")
("Wall Street" "NOUN" "PLACE")
("Uranus" "NOUN" "PLACE")
("Topeka" "NOUN" "PLACE")
("Toledo" "NOUN" "PLACE")
("the White House" "NOUN" "PLACE")
("the Watergate Hotel" "NOUN" "PLACE")
("the Vatican" "NOUN" "PLACE")
("the U.S. Attorney's Office" "NOUN" "PLACE")
("toxic waste dump" "NOUN" "PLACE")
("tavern" "NOUN" "PLACE")
("the Super Bowl" "NOUN" "PLACE|PROPER")
("the South Pole" "NOUN" "PLACE|PROPER")
("the Super Bowl" "NOUN" "PLACE")
("the South Pole" "NOUN" "PLACE")
("service station" "NOUN" "PLACE")
("same place as before" "NOUN" "PLACE")
("river" "NOUN" "PLACE")
("the Phoenix Project" "NOUN" "PLACE|PROPER")
("the Phoenix Project" "NOUN" "PLACE")
("outback" "NOUN" "PLACE")
("ocean" "NOUN" "PLACE")
("the North Pole" "NOUN" "PLACE|PROPER")
("the Last National Bank" "NOUN" "PLACE|PROPER")
("Hotel California" "NOUN" "PLACE|PROPER")
("the North Pole" "NOUN" "PLACE")
("the Last National Bank" "NOUN" "PLACE")
("Hotel California" "NOUN" "PLACE")
("home of a trusted friend" "NOUN" "PLACE")
("hackers' convention" "NOUN" "PLACE")
("the Empire State Building" "NOUN" "PLACE")
@ -231,59 +238,59 @@
("brewery" "NOUN" "PLACE")
("best place possible" "NOUN" "PLACE")
("bathroom" "NOUN" "PLACE")
("Bastille" "NOUN" "PLACE|PROPER")
("Bastille" "NOUN" "PLACE")
("back forty" "NOUN" "PLACE")
("Tel Aviv" "NOUN" "PLACE|PROPER")
("Switzerland" "NOUN" "PLACE|PROPER")
("SJ Games" "NOUN" "PLACE|PROPER")
("Sixth Street" "NOUN" "PLACE|PROPER")
("Siberia" "NOUN" "PLACE|PROPER")
("San Francisco" "NOUN" "PLACE|PROPER")
("Poland" "NOUN" "PLACE|PROPER")
("Peking" "NOUN" "PLACE|PROPER")
("Tel Aviv" "NOUN" "PLACE")
("Switzerland" "NOUN" "PLACE")
("SJ Games" "NOUN" "PLACE")
("Sixth Street" "NOUN" "PLACE")
("Siberia" "NOUN" "PLACE")
("San Francisco" "NOUN" "PLACE")
("Poland" "NOUN" "PLACE")
("Peking" "NOUN" "PLACE")
("my back yard" "NOUN" "PLACE")
("Munich" "NOUN" "PLACE|PROPER")
("Moscow" "NOUN" "PLACE|PROPER")
("Mordor" "NOUN" "PLACE|PROPER")
("Mission Control" "NOUN" "PLACE|PROPER")
("Middle-earth" "NOUN" "PLACE|PROPER")
("Mars" "NOUN" "PLACE|PROPER")
("Munich" "NOUN" "PLACE")
("Moscow" "NOUN" "PLACE")
("Mordor" "NOUN" "PLACE")
("Mission Control" "NOUN" "PLACE")
("Middle-earth" "NOUN" "PLACE")
("Mars" "NOUN" "PLACE")
("Main Street" "NOUN" "PLACE")
("Los Angeles" "NOUN" "PLACE|PROPER")
("London" "NOUN" "PLACE|PROPER")
("Lithuania" "NOUN" "PLACE|PROPER")
("Los Angeles" "NOUN" "PLACE")
("London" "NOUN" "PLACE")
("Lithuania" "NOUN" "PLACE")
("left field" "NOUN" "PLACE")
("Las Vegas" "NOUN" "PLACE|PROPER")
("Lake Geneva" "NOUN" "PLACE|PROPER")
("Katmandu" "NOUN" "PLACE|PROPER")
("Kabul" "NOUN" "PLACE|PROPER")
("Joe's Bar and Grill" "NOUN" "PLACE|PROPER")
("Israel" "NOUN" "PLACE|PROPER")
("Iraq" "NOUN" "PLACE|PROPER")
("Iran" "NOUN" "PLACE|PROPER")
("Hong Kong" "NOUN" "PLACE|PROPER")
("Hollywood" "NOUN" "PLACE|PROPER")
("Hell" "NOUN" "PLACE|PROPER")
("Las Vegas" "NOUN" "PLACE")
("Lake Geneva" "NOUN" "PLACE")
("Katmandu" "NOUN" "PLACE")
("Kabul" "NOUN" "PLACE")
("Joe's Bar and Grill" "NOUN" "PLACE")
("Israel" "NOUN" "PLACE")
("Iraq" "NOUN" "PLACE")
("Iran" "NOUN" "PLACE")
("Hong Kong" "NOUN" "PLACE")
("Hollywood" "NOUN" "PLACE")
("Hell" "NOUN" "PLACE")
("headquarters" "NOUN" "PLACE")
("Gotham City" "NOUN" "PLACE|PROPER")
("Gasoline Alley" "NOUN" "PLACE|PROPER")
("Endsville" "NOUN" "PLACE|PROPER")
("Dime Box" "NOUN" "PLACE|PROPER")
("Death Valley" "NOUN" "PLACE|PROPER")
("Dallas" "NOUN" "PLACE|PROPER")
("Cyberworld" "NOUN" "PLACE|PROPER")
("Chicago" "NOUN" "PLACE|PROPER")
("Cheyenne Mountain" "NOUN" "PLACE|PROPER")
("Callahan's Place" "NOUN" "PLACE|PROPER")
("Buckingham Palace" "NOUN" "PLACE|PROPER")
("Berlin" "NOUN" "PLACE|PROPER")
("Berkeley" "NOUN" "PLACE|PROPER")
("Baghdad" "NOUN" "PLACE|PROPER")
("Austin" "NOUN" "PLACE|PROPER")
("Atlantis" "NOUN" "PLACE|PROPER")
("Alpha Complex" "NOUN" "PLACE|PROPER")
("Alpha Centauri" "NOUN" "PLACE|PROPER")
("Afghanistan" "NOUN" "PLACE|PROPER")
("Gotham City" "NOUN" "PLACE")
("Gasoline Alley" "NOUN" "PLACE")
("Endsville" "NOUN" "PLACE")
("Dime Box" "NOUN" "PLACE")
("Death Valley" "NOUN" "PLACE")
("Dallas" "NOUN" "PLACE")
("Cyberworld" "NOUN" "PLACE")
("Chicago" "NOUN" "PLACE")
("Cheyenne Mountain" "NOUN" "PLACE")
("Callahan's Place" "NOUN" "PLACE")
("Buckingham Palace" "NOUN" "PLACE")
("Berlin" "NOUN" "PLACE")
("Berkeley" "NOUN" "PLACE")
("Baghdad" "NOUN" "PLACE")
("Austin" "NOUN" "PLACE")
("Atlantis" "NOUN" "PLACE")
("Alpha Complex" "NOUN" "PLACE")
("Alpha Centauri" "NOUN" "PLACE")
("Afghanistan" "NOUN" "PLACE")
("(not available at your clearance)" "NOUN" "PLACE")
("Blue Screen of Death" "NOUN" "")
("zero-day exploit" "NOUN" "")
@ -1194,9 +1201,9 @@
)
(setq sentence-structures (append sentence-structures '( (lambda ()
"<name> <preposition> <place> and <action> the <noun>"
(let ((sentence (find-noun-with-article words)))
(setq sentence (format "%s %s %s and %s the %s" sentence (find-pos words "PREPOSITION" 'false) (find-place-noun words) (find-pos words "VERB" 'false) (find-pos words "NOUN" 'true)))
"<name> <preposition> <place> and <action> <noun>"
(let ((sentence ""))
(setq sentence (format "%s %s %s and %s %s" (find-noun-with-article words) (find-pos words "PREPOSITION" 'false) (find-place-noun words) (find-pos words "VERB" 'false) (find-noun-with-article words)))
sentence
)))
)
@ -1232,7 +1239,7 @@
(setq sentence-structures (append sentence-structures '( (lambda ()
"<name> <action> <name> and <pronoun> [random(<adjective>, .5)] <noun>"
(let ((sentence (find-noun-with-article words)))
(setq sentence (format "%s %s and %s" sentence (find-pos words "ACTION" 'false) (find-noun-with-article words) (find-pos words "PRONOUN" 'false)))
(setq sentence (format "%s %s and %s" sentence (find-pos words "VERB" 'false) (find-noun-with-article words) (find-pos words "PRONOUN" 'false)))
(if (<= 5 (random 10))
(setq sentence (format "%s %s" sentence (find-pos words "ADJECTIVE" 'false)))
)
@ -1259,7 +1266,7 @@
(setq sentence-structures (append sentence-structures '( (lambda ()
"You must meet <name> at <place> and retrieve the [random(<adjective>, .5)] <noun>"
(let ((sentence "You must meet"))
(setq sentence (format "%s %s at %s and retrieve the " sentence, (find-noun-with-article words) (find-place-noun words)))
(setq sentence (format "%s %s at %s and retrieve the " sentence (find-noun-with-article words) (find-place-noun words)))
(if (<= 5 (random 10))
(setq sentence (format "%s %s" sentence (find-pos words "ADJECTIVE" 'false)))
)
@ -1271,27 +1278,33 @@
(setq sentence-structures (append sentence-structures '( (lambda ()
"Without the [random(<adjective>,.3)] <noun>, the <noun> <preposition> <place>!"
(let ((sentence "Without the"))
"Without [random(<adjective>,.3)] <noun>, the <noun> <action> <preposition> <place>!"
(let ((sentence "Without"))
(if (<= 3 (random 10))
(setq sentence (format "%s %s" sentence (find-pos words "ADJECTIVE" 'false)))
)
(setq sentence (format "%s, %s %s %s!" sentence (find-noun-with-article words) (find-noun-with-article words) (find-pos words "PREPOSITION" 'false) (find-place-noun words)))
(setq sentence (format "%s, %s %s %s %s %s!" sentence (find-noun-with-article words) (find-noun-with-article words) (find-pos words "VERB" 'false) (find-pos words "PREPOSITION" 'false) (find-place-noun words)))
sentence
)))
)
)
(setq generated-sentence (funcall (nth (random (length sentence-structures)) sentence-structures)))
(defalias 'func-to-call (nth (random (length sentence-structures)) sentence-structures))
(setq generated-sentence (funcall 'func-to-call))
(let ( (interjection (find-pos words "INTERJECTION" 'false)) )
(if (<= 10 (random 10))
(if ((string-match-p "!" interjection))
(setq generated-sentence (format "%s %s" interjection (sentence-case generated-sentence)))
(setq generated-sentence (format "%s %s" interjection generated-sentence))
)
(setq generated-sentence (format "%s" (sentence-case generated-sentence)))
)
)
(if (<= 1 (random 10))
(setq generated-sentence (format "%s %s" (find-pos words "INTERJECTION" 'false) generated-sentence))
)
(if (not (string-match-p "!" generated-sentence))
(setq generated-sentence (format "%s." generated-sentence))
)
(goto-char (point-max))
(insert (format "%s\n" generated-sentence))
)
)