I made some very promising experiments with functions that I will soon publish.
In the first one, replacement test is a function that asks me to choose between to options.
In the second one the complete "replacements" list of the fix is generated by a function. :-)
The 3rd one will be my original task, to analyze the match and give an appropriate replacement.
I have a problem with the forst one: although I can write the old text on screen and ask for a choice, I cannot present the environment of the match. So I have either to give a blind answer or open tha page in a browser firt which makes the process slow down. After I have given the choices for all the matches, replace.py will print a showDiff, but not before I choose.
At the time, I cannot modify edit summary according to the actual replacements but I am not sure it is worth to deal with.