Module talk:zh/data/dial-syn
< Module talk:zh | data
Latest comment: 3 years ago by Erutuon in topic Dialectal Synonyms Category
Dialectal Synonyms Category
[edit]@Justinrleung Hey, I was wondering, maybe we could have a category for all the dialectal synonyms chart that we have in Chinese, so that it would be convenient to see a complete list of all the charts made. Is that possible? --Mar vin kaiser (talk) 09:00, 28 April 2021 (UTC)
- @Mar vin kaiser This is the full list, I think. @Erutuon, I'm not familiar with how the list on the documentation is generated. How should we keep that updated? — justin(r)leung { (t...) | c=› } 14:28, 28 April 2021 (UTC)
- I'd generated the list by running a command (which is in the wikitext of the page) on the
all-titles
dump file and copying the result over. But here is a Pywikibot script that does it a little more easily:import regex as re # https://pypi.org/project/regex/ from pywikibot import Site, Page from pywikibot.pagegenerators import PrefixingPageGenerator en_wiktionary = Site("en", fam = "wiktionary") matches = [] for page in PrefixingPageGenerator(prefix = "Module:zh/data/dial-syn/", site = en_wiktionary): match = re.search(r"/(\p{Han}.*)$", page.title()) if match: matches.append(match[1]) page = Page(en_wiktionary, title = "Module:zh/data/dial-syn/documentation") list = "\n".join(matches) page.text = re.sub(r"(?s)(<!--\s*start\s*list\s*-->).*?(<!--\s*end\s*list\s*-->)", rf"\1\n{list}\n\2", page.text, count = 1) page.save(summary = "update list (bot)", minor = False)
- — Eru·tuon 21:09, 28 April 2021 (UTC)
- I'd generated the list by running a command (which is in the wikitext of the page) on the