Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -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]]];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue