I must tell you that I still use compat, so tell me if any of these is
already implemented in core.
1.
I have a replacement task (replace.py + fixes.py, but as far as I remember,
it is powered by textlib).
I would like to exclude all the articles of countries. Now, it is a
difficult task to identify countries by syntactical analysis of the text
itself. Neither the word "country", nor categories give useful match.
Infoboxes are the best, but still far from good. How great would be an
exception based on Wikidata, which can state "this item is a country". If I
also want to exclude biographies, I could expand my exception list with
"this item is a person" statement.
2.
Of course, if I can except countries, I also would like to require. Now we
have only one kind of requirements, 'require-title'. We could have some
Wikidata-based requirements, too.
3.
At this point we should step over the long survived temporary solution,
that 'require-title' is built among exceptions.
A new 'requirements' dictionary should be invented with as many types as
there are in exceptions. First step is to refactor the existing
functionality, then implementing new ones.
4.
Logical relations should be extended. Now exceptions exclude a page from
text replacing if ANY of them matches, while reqiure-title requires ALL the
conditions to match. Reqire + ANY is much more important than require +
ALL; by taking out requirements from exceptions ot would by possible to
implement ANY (either by keeping ALL, which is of course the better way, or
instead). Combining except rules into ALL relations would also be useful
sometimes.
5.
And now I tell you my secret dream. I would like to create
exception/requiring functions that use the title of the page. If the title
occurs in a certain environment, except or incude the page into
replacements, or use a function for replacement that uses title. I cannot
pass the page title as a parameter. Tell me if it's only my dumbness.
6.
Another dream: replaceexcept should return not only the new text, but
number of replacements, too, as far as it can be defined and measured. I
don't expect perfect result here. Or it may be measured outside
replaceexcept. This would be good for statistical and other reasons, but
more use cases should be described in the future. I think measuring
effectiveness is one of them.
So this would ne the next generation of text replacements. And now I
finally found the correct subject at the last sentence of my message. :-)
--
Bináris