Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -1,14 +1,11 @@
filename = InputString["Enter the filename of the story template: "];
text = Import[filename];
listofblanks = StringCases[text, RegularExpression["<[^>]+>"]] // Union;
listofanswers = {};
Do[
answer = InputString["Enter a/an: " <> listofblanks[[i]]];
AppendTo[listofanswers, answer];
, {i, 1, Length[listofblanks]}
]
Do[
text = StringReplace[text, listofblanks[[i]] -> listofanswers[[i]]]
, {i, 1, Length[listofblanks]}
]
text
text = Import[
InputString["Enter the filename of the story template:"]];
answers =
AssociationMap[
InputString[
"Enter a" <>
If[StringMatchQ[#,
"<" ~~ Alternatives @@ Characters["aeiou"] ~~ ___], "n", ""] <>
" " <> StringTrim[#, "<" | ">"] <> ":"] &,
Union[StringCases[text, RegularExpression["<[^>]+>"]]]];
Print[StringReplace[text, Normal[answers]]];