Hello,
Could this be done fairly easily using PHP?
Let’s say I had a sentence that read:
“My Uncle Tom likes his hot chocolate in my Aunt Betty’s mug.”
Would PHP be able to take multiple words in that sentence and replace them with multiple other words? Here is what I mean:
Let’s start with the word ‘Uncle’.
I would like to be able to input a list of alternative words for the word ‘Uncle’ like this:
Fat Uncle
Silly Uncle
Aunt
Brother
Cousin
Neighbor
And then have that sentence recreated with all those words. So for example I would input that list of 6 alternate words and the script would create these sentences for me:
“My Fat Uncle Tom likes his hot chocolate in my Aunt Betty’s mug.”
“My Silly Uncle Tom likes his hot chocolate in my Aunt Betty’s mug.”
“My Aunt Tom likes his hot chocolate in my Aunt Betty’s mug.”
“My Brother Tom likes his hot chocolate in my Aunt Betty’s mug.”
“My Cousin Tom likes his hot chocolate in my Aunt Betty’s mug.”
“My Neighbor Tom likes his hot chocolate in my Aunt Betty’s mug.”
I’m fairly sure that can be done pretty easily, but here’s what I don’t know...
Could more than one word in the sentence be ‘tagged’ so a second list of words could be applied to another word in the sentence?
For example:
This time let’s pick the words ‘hot chocolate’.
I would have a second list of alternative words that I would want applied to the words ‘hot chocolate’.
Tea
Coffee
Soda
Water
Scotch
Dr. Pepper
Once again I would want the original sentence recreated with these words in place of ‘hot chocolate’. So the output would be:
“My Uncle Tom likes his Tea in my Aunt Betty’s mug.”
“My Uncle Tom likes his Coffee in my Aunt Betty’s mug.”
“My Uncle Tom likes his Soda in my Aunt Betty’s mug.”
“My Uncle Tom likes his Water in my Aunt Betty’s mug.”
“My Uncle Tom likes his Scotch in my Aunt Betty’s mug.”
“My Uncle Tom likes his Dr. Pepper in my Aunt Betty’s mug.”
Now here is the last tricky part...
I would like the script to be able to do both of those things at the same time... which would mean I would end up with 36 new variations of the sentence.
I would only want the word ‘Uncle’ to be replaced with the ‘uncle’ list of words, and I would want ‘hot chocolate to be replaced with only the alternate ‘hot chocolate’ list of words.
Ultimately I would like to be able to ‘tag’ multiple words in the sentence and have the script create ALL possible versions of the sentence with all the new words.
So for example... if I chose a third word and added a list of 6 more alternate words... the script would actually end up giving me 6x6x6=216 new sentence variations.
I’m not sure if all of that made sense. But if it does, can someone tell me if PHP can do this? And if yes... then would it be so difficult to write, that it would cost a fortune?
Thanks for any help with this one.
Kindly,
John