""" * Version: 0.1.0.0.0 * Purposes: * Dump a Markdown which contains a table for narritive suggestions for PE course. * System parameters: * sys_parameter 1: The language code, for example: en, zh, en2zh, zh2en. * sys_parameter 2 (optional): fix """ import sys from pingcap.pe.flash.course_suggestion_seeker import dump_suggestion_table # (bad pattern, suggested pattern, auto_replace_enabled) negative_usage_patterns = { "en_list": [ ("federated index", "composite index", "Y"), ("point check", "point query", "Y"), ("if possible", "when possible", "Y"), (" ,", "__potential-issue__", "N"), ("‘", "'", "Y"), (":", ":", "Y"), (",", ",", "Y"), ("`、`", ", ", "Y"), ("` : ", "`: ", "Y"), ("` : ", "`: ", "Y"), ("“", '"', "Y"), ("”", '"', "Y"), ("’", "'", "Y"), ], "zh_list": [ ("课后小测验", "Quiz", "Y"), ("章节小测验", "Quiz", "Y"), ("小测验", "Quiz", "Y"), ("特性", "功能", "Y"), ("以上都可以", "以上全部正确", "Y"), ("选项全部正确", "以上全部正确", "Y"), ("单条 SQL", "单个 SQL 语句", "Y"), ("联合索引", "复合索引", "Y"), ("点查", "点查询", "Y"), ("压测", "压力测试", "Y"), ("隐式转换", "隐式数据类型转换", "Y"), ("[0-9]w", "W是否为万的意思?", "N"), ("混部", "实例类型混合部署", "Y"), ("案例一", "案例 A", "Y"), ("案例二", "案例 B", "Y"), ("案例三", "案例 C", "Y"), ("案例四", "案例 D", "Y"), ("案例五", "案例 E", "Y"), ("案例六", "案例 F", "Y"), ("案例七", "案例 G", "Y"), ("案例八", "案例 H", "Y"), ("案例九", "案例 I", "Y"), ("(一)", "\\(A\\)", "Y"), ("(二)", "\\(B\\)", "Y"), ("(三)", "\\(C\\)", "Y"), ("(四)", "\\(D\\)", "Y"), ("(五)", "\\(E\\)", "Y"), ("(六)", "\\(F\\)", "Y"), ("(七)", "\\(G\\)", "Y"), ("(八)", "\\(H\\)", "Y"), ("(九)", "\\(I\\)", "Y"), ("\\(一\\)", "\\(A\\)", "Y"), ("\\(二\\)", "\\(B\\)", "Y"), ("\\(三\\)", "\\(C\\)", "Y"), ("\\(四\\)", "\\(D\\)", "Y"), ("\\(五\\)", "\\(E\\)", "Y"), ("\\(六\\)", "\\(F\\)", "Y"), ("\\(七\\)", "\\(G\\)", "Y"), ("\\(八\\)", "\\(H\\)", "Y"), ("\\(九\\)", "\\(I\\)", "Y"), (" ,", "__potential-issue__", "N"), ("‘", "'", "Y"), ("`、`", ", ", "Y"), ("` : ", "`: ", "Y"), ("` : ", "`: ", "Y"), ("“", '"', "Y"), ("”", '"', "Y"), ("’", "'", "Y"), ], } if __name__ == "__main__": lang_code = sys.argv[1] if len(sys.argv) == 2: dump_suggestion_table( lang_code, sorted(negative_usage_patterns[lang_code[-2:] + "_list"]) ) elif len(sys.argv) == 3 and sys.argv[2] == "fix": dump_suggestion_table( lang_code, sorted(negative_usage_patterns[lang_code[-2:] + "_list"]), True )