Module pywander_text.country_zh_abbr
一般国外著作作者前面需要加上国籍简写,但这个没有一个标准,所以临时编写本脚本。
- 人口数较多的国家在简写上具有更高的优先级
- 香港 澳门 台湾 中国 已移除
- 某些简写如果在中文停用词里面,一般来说这个简写不太具有含义,不推荐使用,比如阿,哈,所,以,什么的
Functions
def get_country_zh_abbr(country)
-
Expand source code
def get_country_zh_abbr(country): """ 获取目标国家中文简称 """ country_name = helper_convert_country_name(country) for k,v in country_zh_abbr_dict.items(): if country_name == v: return k else: logger.warning(f'unknown {country}') return "未知的国家全称名"
获取目标国家中文简称
def get_full_country_name(country_abbr)
-
Expand source code
def get_full_country_name(country_abbr): if country_abbr in country_zh_abbr_dict: return country_zh_abbr_dict[country_abbr] else: return "未知的国家名缩写"
def helper_convert_country_name(country_name)
-
Expand source code
def helper_convert_country_name(country_name): for k,v in helper_country_name_dict.items(): if country_name in v: return k return country_name