Replace words with different synonyms and print each combination in a text file

yes there is! Give me a few minutes, I’ll write a simple program that shows you how

edit: It is more difficult than expected. The main issue I found was the unconstant amount of things you need to change.
So if you have: a = {a,b,c} b = {b,c,d} c = {e,a,t},…
you need a for loop for each and every one of them.

so:
abe ace ade
aba aca ada
abt act adt

bbe ace ade
bba aca ada
bbt act at

cbe ace ade
cba aca ada
cbt act at

in short, you need an n amount of for loops.

here is a program with 2 variable segments:

Code (for 2 only)
String a[] = {"1","2","3","4"}, b[] = {"a","b","c","d"};
ArrayList<String> use = new ArrayList<String>();
void setup() {
  size(600,600);
}
void draw() {
  
  for(int i = 0; i < a.length; i++) {
    for(int j = 0; j < b.length; j++) {
      println(a[i],b[j]);
    }
  }
  
  noLoop();
}

1 a1 b1 c1 d
2 a2 b2 c2 d
3 a3 b3 c3 d
4 a4 b4 c4 d

1 Like