We are about to switch to a new forum software. Until then we have removed the registration on this forum.
here words from text 2 (adjectives) that appear in text 1 (poem) are highlighted in text 1. You could of course use different colors instead of green
You wrote:
whether the replace function can be used to replace characteristics instead of words. So, a blue "lovely" replaces a black "lovely", font-wise, but stays in the same place on the page
in which way is the data "blue" stored in the word lovely in your example?
Chrisir
//===========================================================================
// FINAL FIELDS:
final int Y_OFFSET=100;
//===========================================================================
// GLOBAL VARIABLES:
final int TEXT_SIZE=14;
String [] poem = new String[15]; // input text
String [] poem2 = new String[15]; // input text
boolean isHighlighted=false;
String[] adj = {
"happy", "rotating", "red", "fast", "elastic", "smiley", "unbelievable", "infinite", "surprising",
"mysterious", "glowing", "green", "blue", "tired", "hard", "soft", "transparent", "long", "short",
"excellent", "noisy", "silent", "rare", "normal", "typical", "living", "clean", "glamorous",
};
//===========================================================================
// PROCESSING DEFAULT FUNCTIONS:
void settings() {
size(1500, 600);
}
void setup() {
// textAlign(CENTER, CENTER);
rectMode(CENTER);
fill(255);
strokeWeight(2);
textSize(TEXT_SIZE);
poem[0]="i love you much glamorous darling ";
poem[1]="i love you much surprising darling ";
poem[2]="more than anyone on the earth and i";
poem[3]="like you better than everything in the sky";
poem[4]="-sunlight and singing welcome your coming";
poem[5]="although winter may be everywhere";
poem[6]="with such a silence and such a darkness";
poem[7]="noone can quite begin to guess";
poem[8]="(except my life)the true time of year-";
poem[9]="and if what calls itself a clean world should have";
poem[10]="the luck to hear such singing (or glimpse such";
poem[11]="sunlight as will leap higher than high";
poem[12]="through gayer than gayest someone's heart at your each";
poem[13]="nearness) everyone certainly would (my";
poem[14]="most beautiful darling) believe in nothing but love.";
for (int i=0; i<poem.length; i++) {
poem2[i] = poem[i].toString();
}
}
void draw() {
background(0);
showRawData();
}
//===========================================================================
// PROCESSING DEFAULT INPUT FUNCTIONS:
void keyPressed() {
if (key==' ')
{
if (isHighlighted) {
// reset
isHighlighted=false;
for (int i=0; i<poem.length; i++) {
poem[i] = poem2[i].toString();
}
}
//
else {
// highlight
isHighlighted=true;
for (int i=0; i<poem.length; i++) {
for (int i2=0; i2<adj.length; i2++) {
// is this word adj[i2] in poem ?
if (poem[i].contains(adj[i2])) {
poem[i]=poem[i].replace(adj[i2], "<> "+adj[i2]+" <>");
}
}
}
}
}
}
//===========================================================================
// OTHER FUNCTIONS:
void showRawData() {
fill(255, 0, 0); // red
text("changing text", 300, 44);
fill(255, 0, 0); // red
String a1="";
for (int i=0; i<33; i++)
a1+="+++ Hit space +++";
text(a1, 0, height-44);
String textAdd;
boolean insideWord=false;
fill(255); // white
for (int i=0; i<poem.length; i++) {
fill(255); // white
String[] line1 = split (poem[i], " ");
textAdd="";
for (int i2=0; i2<line1.length; i2++) {
if (line1[i2].trim().equals("<>")) {
if (insideWord)
{
fill(255); // white
insideWord=false;
} else {
fill(0, 255, 0); // green
insideWord=true;
}
} else {
text(line1[i2], float(300)+textWidth(textAdd), Y_OFFSET + i*2*TEXT_SIZE);
textAdd+=line1[i2]+" ";
}
}
}
fill(255, 0, 0); // red
text("Words that are looked for on the left side", 700, 44);
fill(255); // white
text(join(adj, " "),
900, 555,
400, 800);
}
//
Why not have an adjective class that just hold the adjectives, another class that just holds other strings and then pick sentences and adjectives and joining them together. It would be like having to bagsof notes. Adjectives in one and sentences in the other.
You just reach into the bag and pull out two strings/notes and put them together.
Please check
https://forum.processing.org/two/discussion/comment/120544/#Comment_120544
Also
https://forum.processing.org/two/search?Search=adjectives
https://forum.processing.org/two/search?Search=adverbs
Kf
@koogs thank you! That got me started on the right path.
For future reference, I discovered the contains function (seems to be more a general java function) and have used that to easily pick up parts of speech in the adlib.
With your arrays in mind, it looks something like this:
if (sentence[rand].contains("ADJECTIVES")) {
text(sentence[rand].replaceFirst("ADJECTIVES", adjectives[adjRand]), width/2,
height/2);
}
well, replaceFirst(ADJECTIVE, adjectives(random(...)); will replace the first ADJECTIVE. so just call it again with the other things - replaceFirst(NOUN, nouns(random(...)) etc. if there aren't any then it won't do anything.
repeat until you have no more tokens in the input string. (how would you know? perhaps use {ADJECTIVE} instead of just ADJECTIVE then you can check the input string for {... )
Working over this more, that would be my next question -- using replaceFirst(), how do you pull from other arrays, if one sentence is using nouns or adjectives, or pronouns? The way I've written it so far, it will just pull from one array and not recognize another one.
Instead of println(join (poem,(adj[rand])));
use println(concat (poem,(adj[rand])));
https://processing.org/reference/concat_.html
Kf
//INSTRUCTIONS:
// *-- Either by pressing 1 or 2 will show raw (unmodified) poem or the modified data
// *-- When showing modified data, you can click in a line to replace
// *-- the lead word for one of the adjectives.
// *--
//===========================================================================
// IMPORTS:
//===========================================================================
// FINAL FIELDS:
final int Y_OFFSET=100;
final String LEAD_WORD="ADJECTIVE";
//===========================================================================
// GLOBAL VARIABLES:
final int TEXT_SIZE=14;
final int SHOW_RAW=0;
final int SHOW_NEW=1;
String [] poem = new String[15]; // input text
String [] words = new String[0]; // empty 0 len array for words
String [] poemUpdated=new String[poem.length];
;
int showState=SHOW_RAW;
String[] adj = {
"happy", "rotating", "red", "fast", "elastic", "smiley", "unbelievable", "infinite", "surprising",
"mysterious", "glowing", "green", "blue", "tired", "hard", "soft", "transparent", "long", "short",
"excellent", "noisy", "silent", "rare", "normal", "typical", "living", "clean", "glamorous",
};
//===========================================================================
// PROCESSING DEFAULT FUNCTIONS:
void settings() {
size(500, 600);
}
void setup() {
textAlign(CENTER, CENTER);
rectMode(CENTER);
fill(255);
strokeWeight(2);
textSize(TEXT_SIZE);
poem[0]="i love you much ADJECTIVE darling ";
poem[1]="i love you much ADJECTIVE darling ";
poem[2]="more than anyone on the earth and i";
poem[3]="like you better than everything in the sky";
poem[4]="-sunlight and singing welcome your coming";
poem[5]="although winter may be everywhere";
poem[6]="with such a silence and such a darkness";
poem[7]="noone can quite begin to guess";
poem[8]="(except my life)the true time of year-";
poem[9]="and if what calls itself a world should have";
poem[10]="the luck to hear such singing(or glimpse such";
poem[11]="sunlight as will leap higher than high";
poem[12]="through gayer than gayest someone's heart at your each";
poem[13]="nearness)everyone certainly would(my";
poem[14]="most beautiful darling)believe in nothing but love";
arrayCopy(poem, poemUpdated );
}
void draw() {
background(0);
if (showState == SHOW_RAW)
showRawData();
else
showUpdatedData();
}
void keyReleased() {
if (key=='1')
showState = SHOW_RAW;
if (key=='2')
showState = SHOW_NEW;
}
void mouseReleased() {
if (key!='2')
return;
int line=constrain((mouseY-Y_OFFSET)/(2*TEXT_SIZE), 0, poem.length-1);
println(mouseY + " line selected @"+line);
//Nothing to do if none of the poems lines was selected
if (line>=poem.length)
return;
arrayCopy(poem, poemUpdated );
String ss = new String(poemUpdated[line]);
int idx=int(random(adj.length));
poemUpdated[line]=ss.replaceAll(LEAD_WORD, adj[idx]);
println(idx + " is "+ adj[idx] + " ===> "+poemUpdated[line]);
}
//===========================================================================
// OTHER FUNCTIONS:
void showRawData() {
fill(255);
for (int i=0; i<poem.length; i++) {
text(poem[i], width/2, Y_OFFSET + i*2*TEXT_SIZE);
}
}
void showUpdatedData() {
fill(255, 150, 20);
for (int i=0; i<poemUpdated.length; i++) {
text(poemUpdated[i], width/2, Y_OFFSET + i*2*TEXT_SIZE);
}
}
Hello all!
Creating an adlib poem generator and was wondering if anyone knew how to go about inserting a random array element into another array. I looked up the join function but the issue comes when you only need to use it once. I read that java/Processing can't dynamically insert elements? Not sure if that's true or not.
String [] poem = new String[15]; // input text
String [] words = new String[0]; // empty 0 len array for words
String[] adj = {
"happy", "rotating", "red", "fast", "elastic", "smiley", "unbelievable", "infinite", "surprising",
"mysterious", "glowing", "green", "blue", "tired", "hard", "soft", "transparent", "long", "short",
"excellent", "noisy", "silent", "rare", "normal", "typical", "living", "clean", "glamorous",
};
void setup(){
poem[0]="i love you much ADJECTIVE darling ";
poem[1]="i love you much ADJECTIVE darling ";
poem[2]="more than anyone on the earth and i";
poem[3]="like you better than everything in the sky";
poem[4]="-sunlight and singing welcome your coming";
poem[5]="although winter may be everywhere";
poem[6]="with such a silence and such a darkness";
poem[7]="noone can quite begin to guess";
poem[8]="(except my life)the true time of year-";
poem[9]="and if what calls itself a world should have";
poem[10]="the luck to hear such singing(or glimpse such";
poem[11]="sunlight as will leap higher than high";
poem[12]="through gayer than gayest someone's heart at your each";
poem[13]="nearness)everyone certainly would(my";
poem[14]="most beautiful darling)believe in nothing but love";
I'd like to do have it so that when the mouse is pressed, it pulls out a random line of the poem so my first try of combining all the sentences under one array name (like I did with the adjectives) doesn't quite work (unless I'm mistaken). Abridged example below.
String[] poem = {"i love you much ",". darling"};
String [] adj = { "happy", "rotating", "red", "fast", "elastic", "smiley"};
int rand = int(random(adj.length));
println(join (poem,(adj[rand])));
exit();
Any pointers would help, thank you!
String[] adjective1 = loadStrings("adjectives.txt");
String[] noun1 = loadStrings("nouns.txt");
String[] adverb1 = loadStrings("adverbs.txt");
String[] verb1 = loadStrings("verbs.txt");
String[] adjective = loadStrings("adjectives.txt");
String[] noun = loadStrings("nouns.txt");
void setup ( )
adjective1 = loadStrings("adjectives.txt");
noun1 = loadStrings("nouns.txt");
adverb1 = loadStrings("adverbs.txt");
verb1 = loadStrings("verbs.txt");
adjective = loadStrings("adjectives.txt");
noun = loadStrings("nouns.txt");
{
size(500,500);
background(0);
}
Would it be along the lines of that then? I am still working on correctly structuring my code. I am looking at split[] now
the String[] adjective1;
should go before the setup() to make it a global variable available everywhere.
adjective1 = loadStrings("adjectives.txt");
should be in the setup() to do the actual loading.
if you try and load before setup() it won't know where to look for the file.
I want to practice or get an idea of what it would be like to pull from an external file, but I do not have a very good understanding of coding yet and would like to learn more. I know I want to use strings and arrays. If anyone could help it would be awesome!
I have four texts files with words to pull from, labeled noun, adjective, etc.
So part of my code looks like this : String[] adjective1 = loadStrings("adjectives.txt");
But I am not sure if that is correct
String[] nouns;
String[] verbs;
String[] adjectives;
//int fileCount= 0;
String storyTemplate1= "I really like %noun% " + "." + "It all began when %name1% %verb% with %noun%";
//String storyTemplate2= "It all began when %name1% %verb% with %noun%";
void setup(){
size(600,600);
nouns= loadStrings("Nouns.txt");
verbs= loadStrings("Verbs.txt");
adjectives= loadStrings("Adjectives.txt");
//for(int i=0; i<nouns.length; i++){
// println(nouns[i]);
//}
String story1= instantiateStory(storyTemplate1);
String[] output= new String[1];
output[0]= story1;
saveStrings("story1.txt", output);
}
//void mousePressed(){
// int randomIndex= (int)random(0, nouns.length);
// String[] output= new String[1];
// output[0]= nouns[randomIndex];
// saveStrings(fileCount +".txt", output);
// fileCount++;
//}
void draw(){
}
String noun1(int randomIndex){
String noun1 = " ";
//randomIndex= ;
String[] output= new String[1];
output[0]= nouns[randomIndex];
noun1= nouns[randomIndex];
return noun1;
}
String instantiateStory(String template){
String story= " ";
String[] splitTemplate= split(template, " ");
for( int i=0; i<splitTemplate.length; i++){
if(splitTemplate[i].equals("%noun%")){
story = story + noun1() + " ";
}
else if(splitTemplate[i].equals("%verb%")){
int randomIndex= (int)random(0, nouns.length);
String[] output= new String[1];
output[0]= verbs[randomIndex];
story = story + verbs[randomIndex] + "ed" + " ";
}
else if(splitTemplate[i].equals("%name1%")){
int randomIndex= (int)random(0, nouns.length);
story = story + "Harry" + " ";
}
else{
story = story + splitTemplate[i] + " ";
}
}
return story;
}``
I've solved how to add numerous random parts of speech into my string stories, but I have run into a couple of issues. Most importantly: I want my code to remember one of the random names: i.e. "(random name) likes (random noun), but (same random name) also likes (random noun)."
Additionally, I have been able to output a couple of different stories (via separate text documents) that say different things, but still use the random parts of speech aspect, but story2 also says "null" below what it outputs in the text document. How do I fix this?
I'm far more concerned about the name remembrance than the "null" issue. Code is below: Any ideas?
String[] nouns={"house", "car", "cat"};
String[] verbs={"jumps", "runs", "tells" };
String[] adjectives={"yellow", "adorable", "helpful" };
String[] names={"Tiger", "Phil", "Jack", "Arnold" };
int fileCount = 0;
String storyTemplate1 = "One day %name% was %verb% by with a walkman on when %name% saw a %noun% giving him an %adjective% eye and I %verb% him off in the parking lot. I don't give a damn if it's dark or not, I'm harder than me trying to park a %noun% .";
String storyTemplate2 = " %name% %verb% %adjective% %noun% .";
void setup() {
size(200, 200);
nouns = loadStrings("Nouns.txt");
verbs = loadStrings("Verbs.txt");
adjectives = loadStrings("Adjectives.txt");
names = loadStrings("Names.txt");
String story1 = instantiateStory(storyTemplate1);
String story2 = buildStory(storyTemplate2);
String[] output = new String[1];
String[] output2 = new String[2];
output[0] = story1;
output2[0] = story2;
saveStrings("story1.txt", output);
saveStrings("story2.txt", output2);
}
String instantiateStory(String template) {
String story = "";
String[] splitTemplate = split(template, " ");
for (int i = 0; i < splitTemplate.length; i++) {
//
if (splitTemplate[i].equals("%noun%")) {
//Adds a random noun to story
story = story + getRandomNoun() + " ";
} else if (splitTemplate[i].equals("%verb%")) {
story = story + getRandomVerb() + " ";
} else if (splitTemplate[i].equals("%adjective%")) {
story = story + getRandomAdjective() + " ";
}
else if (splitTemplate[i].equals("%name%")) {
story = story + getRandomName() + " ";
}
else {
story = story + splitTemplate[i] + " ";
}
}
return story;
}
String buildStory(String template2) {
String story2 = "";
String[] splitTemplate2 = split(template2, " ");
for (int i = 0; i < splitTemplate2.length; i++) {
if (splitTemplate2[i].equals("%noun%")) {
//Adds a random noun to story
story2 = story2 + getRandomNoun() + " ";
} else if (splitTemplate2[i].equals("%verb%")) {
story2 = story2 + getRandomVerb() + " ";
} else if (splitTemplate2[i].equals("%adjective%")) {
story2 = story2 + getRandomAdjective() + " ";
}
else if (splitTemplate2[i].equals("%name%")) {
story2 = story2 + getRandomName() + " ";
}
else {
story2 = story2 + splitTemplate2[i] + " ";
}
}
return story2;
}
String getRandomNoun() {
int randomIndex = (int)random(0, nouns.length);
return nouns[randomIndex];
}
String getRandomVerb() {
int randomIndex = (int)random(0, verbs.length);
return verbs[randomIndex];
}
String getRandomAdjective() {
int randomIndex = (int)random(0, adjectives.length);
return adjectives[randomIndex];
}
String getRandomName() {
int randomIndex = (int)random(0, names.length);
return names[randomIndex];
}
String[] nouns;
String[] verbs;
String[] adjectives;
//int fileCount= 0;
String storyTemplate1= "I really like %noun%";
String storyTemplate2= "It all began when %name1% %verb% with %noun%";
void setup(){
size(600,600);
nouns= loadStrings("Nouns.txt");
verbs= loadStrings("Verbs.txt");
adjectives= loadStrings("Adjectives.txt");
//for(int i=0; i<nouns.length; i++){
// println(nouns[i]);
//}
String story1= instantiateStory(storyTemplate1) + instantiateStory(storyTemplate2);
String[] output= new String[1];
output[0]= story1;
saveStrings("story1.txt", output);
}
//void mousePressed(){
// int randomIndex= (int)random(0, nouns.length);
// String[] output= new String[1];
// output[0]= nouns[randomIndex];
// saveStrings(fileCount +".txt", output);
// fileCount++;
//}
void draw(){
}
String noun1(String noun1){
noun1 = " ";
int randomIndex= (int)random(0, nouns.length);
String[] output= new String[1];
output[0]= nouns[randomIndex];
noun1= nouns[randomIndex];
return noun1;
}
String instantiateStory(String template){
String story= " ";
String[] splitTemplate= split(template, " ");
for( int i=0; i<splitTemplate.length; i++){
if(splitTemplate[i].equals("%noun%")){
story = story + noun1 + " ";
}
else if(splitTemplate[i].equals("%verb%")){
randomIndex= (int)random(0, nouns.length);
output[0]= verbs[randomIndex];
story = story + verbs[randomIndex] + "ed" + " ";
}
else if(splitTemplate[i].equals("%name1")){
randomIndex= (int)random(0, nouns.length);
story = story + "Harry" + " ";
}
else{
story = story + splitTemplate[i] + " ";
}
}
return story;
}
Hi all,
One of aBe's FunProgramming lessons makes a star effect where white ellipses appear at random and then fade. I'm trying to do something similar, with random text from a String []; but it's not working. Any suggestions?
The code below makes one word from the array appear at a random position. But (I think) it's being replaced by the same word in the same position.
String[] nouns = {
"realta", "commanach", "madra", "dearg", "saoirse", "daoirse"
};
//String[] adjectives = {"happy","angry","infinite","red","frightened","free"};
int m = int (random(6));
int n = int(random(6));
int ran = int(random(300));
int ranW = int(random(300));
void setup() {
frameRate(1); //just for now- to make debugging clearer
size(800, 600);
background (0);
}
void draw() {
//fill(0,20);
//fill(255);
//rect(0,0,width,height);
flashWords();
}
void flashWords() {
fill(0);
rect(0, 0, width, height);
fill(225);
text(nouns[n], 100+ranW, 300+ran);
//frameRate(1);
//ellipse (random (width), random (height), 4, 4 );
//text(adjectives[m],ranW,ran-10);
}
I'll just assume it's the latter. A simple loadStrings() will do the whole work then:
https://processing.org/reference/loadStrings_.html
In order to store the output from loadStrings(), we're gonna need Map<String, String[]>.
// forum.processing.org/two/discussion/10726/
// php-to-processing-variable-variables
// 2015-May-11
final String[] LIST = {
"interjections",
"determiners",
"adjectives",
"nouns",
"adverbs",
"verbs",
"prepositions",
"conjunctions",
"comparatives"
};
import java.util.Map;
import java.util.Map.Entry;
final int CAPACITY = ceil(LIST.length/.75);
final Map<String, String[]> grammar = new HashMap<String, String[]>(CAPACITY);
for (String entry : LIST) grammar.put(entry, loadStrings(entry + ".txt"));
for (Entry<String, String[]> pair : grammar.entrySet()) {
println(pair.getKey(), ':');
printArray(pair.getValue());
println();
}
print("Random word value from \"verbs\" key: ");
String[] words = grammar.get("verbs");
println("\"" + words[(int) random(words.length)] + "\"");
exit();
Before anything, an alternative to previous example: :D
// forum.processing.org/two/discussion/10726/
// php-to-processing-variable-variables
final String[] lists = {
"interjections",
"determiners",
"adjectives",
"nouns",
"adverbs",
"verbs",
"prepositions",
"conjunctions",
"comparatives"
};
import java.util.Map;
import java.util.Map.Entry;
final int capacity = ceil(lists.length/.75), len = 2;
final Map<String, char[]> chars = new HashMap<String, char[]>(capacity);
for (String part : lists) {
char[] ch = new char[len];
for ( int i = 0; i != len; ch[i++] = part.charAt((int) random(part.length())) );
chars.put(part, ch);
}
for (Entry<String, char[]> pair : chars.entrySet()) {
print(pair.getKey(), ": ");
for (char ch : pair.getValue()) print(ch, ' ');
println();
}
println("\nverbs:", chars.get("verbs")[0], chars.get("verbs")[1]);
exit();
In Java, the []
array access operator always means the index of some array:
https://processing.org/reference/arrayaccess.html
Seems like in PHP, []
has multiple meanings.
While in ${$part}[$i] =
the []
over there means array access,
in ${$part}[rand( ... )]
apparently it means a char
position within the String now.
And translating the latter to Java's String, it corresponds to its method charAt():
https://processing.org/reference/String_charAt_.html
Plus the count() function would correspond to String's length() method:
https://processing.org/reference/String_length_.html
And obviously, rand() is Processing's random(): 3:-O
https://processing.org/reference/random_.html
In short, it's randomly picking up 1 char
outta the String as value and associating it w/ the same String as the key.
So the {key : value} pair relationship is <String, Character>
in Java.
For that, this time we're gonna use a HashMap<String, Character> in place of previous StringDict.
More specifically, an array of Map<String, Character>[]: :D
https://processing.org/reference/HashMap.html
You see, If I got that right, the ${$part}[$i]
is actually creating an array of Map[] in order to store 1 random() char
.
Well, here it goes the probable solution for your mysterious PHP sample: #:-S
// forum.processing.org/two/discussion/10726/
// php-to-processing-variable-variables
final String[] lists = {
"interjections",
"determiners",
"adjectives",
"nouns",
"adverbs",
"verbs",
"prepositions",
"conjunctions",
"comparatives"
};
import java.util.Map;
final int capacity = ceil(lists.length/.75);
final Map<String, Character>[] chars = new Map[] {
new HashMap<String, Character>(capacity), new HashMap<String, Character>(capacity)
};
for (String part : lists) for (int i = 0; i != chars.length; ++i)
chars[i].put( part, part.charAt((int) random(part.length())) );
printArray(chars);
println();
println("verbs:", chars[0].get("verbs"), chars[1].get("verbs"));
exit();
Dunno PHP, sorry. And Java, just like C/C++, is very strongly typed.
That is, in Java we gotta declare the type of each variable and each container.
Your $lists seems like an array of String[] type.
So it's something like: String[] lists = {}
Unfortunately, we can't dynamically create variables in Java.
That is, all variables gotta be explicitly written in the source.
We can't just pick or concatenate a String and state that is a new variable now.
However, we can use a Map type container w/ {key : value} pairs.
I've chosen StringDict for this attempt: https://processing.org/reference/StringDict.html
But some HashMap<String, String> would be even faster...
// forum.processing.org/two/discussion/10726/
// php-to-processing-variable-variables
final String[] lists = {
"interjections",
"determiners",
"adjectives",
"nouns",
"adverbs",
"verbs",
"prepositions",
"conjunctions",
"comparatives"
};
final StringDict paths = new StringDict(lists.length);
for (String part : lists) paths.set(part, dataPath(part + ".txt"));
println(paths);
println();
println("verbs:", paths.get("verbs"));
exit();
I am still having issues with the spacing
this must be
println ( "The "+ adj1 +""+ adj2 +""+ noun1 +""+ noun2 +""+ verb1 +""+ adverb1 + "!");
not " and immediately another " but one space sign between them : " "
it's just adding a space sign between the words using +
you just forgot the space sign between " and "
How does it work in the load strings?
loadstrings loads the entire text file.
the words in it are separated in lines / paragraphs.
loadstrings splits the text file at the paragraphs and distributes in into the list / array adjectives
each entry in the array is one adjective / one paragraph / line from the file.