gpt4 book ai didi

java - 如何从给定的 iso 语言代码中检索匹配的宏语言区域设置?

转载 作者:行者123 更新时间:2023-12-04 18:08:28 25 4
gpt4 key购买 nike

给定一个 ISO 639-2/T范围个体的语言代码,我如何以编程方式找到匹配的 macrolanguage代码,如果匹配存在?

例如,如何从“nob”(挪威语 Bokmål,范围个体)到“nor”(挪威语,范围宏语言)?

一般来说,在同一个国家可能有多种不属于同一个宏语言的单独语言,因此单独按国家分组会产生误报。

java.util.locale 知道 ISO 639 三字母语言代码并识别上面示例中的两个代码,但没有范围和宏语言的概念。

在我的情况下,没有误报的启发式方法也很有帮助。

最佳答案

您可以列出您自己的宏语言和相应的单个语言。

这是 list :
https://iso639-3.sil.org/code_tables/639/data/all?title=&field_iso639_cd_st_mmbrshp_639_1_tid=All&name_3=&field_iso639_element_scope_tid=76&field_iso639_language_type_tid=All&items_per_page=200

这是我前段时间做的一个选择:

public static final Map<String, String> macroLanguages = new HashMap<>();
static {
macroLanguages.put("aao", "ara"); //https://iso639-3.sil.org/code/ara
macroLanguages.put("abh", "ara");
macroLanguages.put("abv", "ara");
macroLanguages.put("acm", "ara");
macroLanguages.put("acq", "ara");
macroLanguages.put("acw", "ara");
macroLanguages.put("acx", "ara");
macroLanguages.put("acy", "ara");
macroLanguages.put("adf", "ara");
macroLanguages.put("aeb", "ara");
macroLanguages.put("aec", "ara");
macroLanguages.put("afb", "ara");
macroLanguages.put("ajp", "ara");
macroLanguages.put("apc", "ara");
macroLanguages.put("apd", "ara");
macroLanguages.put("arb", "ara");
macroLanguages.put("arq", "ara");
macroLanguages.put("ars", "ara");
macroLanguages.put("ary", "ara");
macroLanguages.put("arz", "ara");
macroLanguages.put("auz", "ara");
macroLanguages.put("avl", "ara");
macroLanguages.put("ayh", "ara");
macroLanguages.put("ayl", "ara");
macroLanguages.put("ayn", "ara");
macroLanguages.put("ayp", "ara");
macroLanguages.put("bbz", "ara");
macroLanguages.put("pga", "ara");
macroLanguages.put("shu", "ara");
macroLanguages.put("ssh", "ara");

macroLanguages.put("ekk", "est"); //https://iso639-3.sil.org/code/est
macroLanguages.put("vro", "est");

macroLanguages.put("bos", "hbs"); //https://iso639-3.sil.org/code/hbs
macroLanguages.put("hrv", "hbs");
macroLanguages.put("srp", "hbs");
macroLanguages.put("cnr", "hbs");

macroLanguages.put("ltg", "lav"); //https://iso639-3.sil.org/code/lav
macroLanguages.put("lvs", "lav");

macroLanguages.put("nno", "nor"); //https://iso639-3.sil.org/code/nor
macroLanguages.put("nob", "nor");

macroLanguages.put("aae", "sqi"); //https://iso639-3.sil.org/code/sqi
macroLanguages.put("aat", "sqi");
macroLanguages.put("aln", "sqi");
macroLanguages.put("als", "sqi");

macroLanguages.put("ydd", "yid"); //https://iso639-3.sil.org/code/yid
macroLanguages.put("yih", "yid");

macroLanguages.put("ccx", "zha"); //https://iso639-3.sil.org/code/zha
macroLanguages.put("ccy", "zha");
macroLanguages.put("zch", "zha");
macroLanguages.put("zeh", "zha");
macroLanguages.put("zgb", "zha");
macroLanguages.put("zgm", "zha");
macroLanguages.put("zgn", "zha");
macroLanguages.put("zhd", "zha");
macroLanguages.put("zhn", "zha");
macroLanguages.put("zlj", "zha");
macroLanguages.put("zln", "zha");
macroLanguages.put("zlq", "zha");
macroLanguages.put("zqe", "zha");
macroLanguages.put("zyb", "zha");
macroLanguages.put("zyg", "zha");
macroLanguages.put("zyj", "zha");
macroLanguages.put("zyn", "zha");
macroLanguages.put("zzj", "zha");

macroLanguages.put("cdo", "zho"); //https://iso639-3.sil.org/code/zho
macroLanguages.put("cjy", "zho");
macroLanguages.put("cmn", "zho");
macroLanguages.put("cpx", "zho");
macroLanguages.put("czh", "zho");
macroLanguages.put("czo", "zho");
macroLanguages.put("gan", "zho");
macroLanguages.put("hak", "zho");
macroLanguages.put("hsn", "zho");
macroLanguages.put("lzh", "zho");
macroLanguages.put("mnp", "zho");
macroLanguages.put("nan", "zho");
macroLanguages.put("wuu", "zho");
macroLanguages.put("yue", "zho");
macroLanguages.put("cnp", "zho");
macroLanguages.put("csp", "zho");

macroLanguages.put("pes", "fas"); //https://iso639-3.sil.org/code/fas
macroLanguages.put("prs", "fas");
}

关于java - 如何从给定的 iso 语言代码中检索匹配的宏语言区域设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20452324/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com