Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/nameparser/config/surnames.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

4 statements  

1from nameparser.config._invariants import assert_normalized 

2 

3# Born a frozenset (#293's convention: a mutable module constant would 

4# silently desync the cached ``Lexicon.default()`` from the shim's 

5# per-construction copies). 

6# 

7# Single-syllable surnames in census rank order, 10 per row; the cut is 

8# the top ~94 -- append new entries at the tail, do not alphabetize 

9# (rank order is the only in-file record of where the coverage floor 

10# sits). 

11KOREAN_SURNAMES = frozenset({ 

12 "김", "이", "박", "최", "정", "강", "조", "윤", "장", "임", 

13 "한", "오", "서", "신", "권", "황", "안", "송", "전", "홍", 

14 "유", "고", "문", "양", "손", "배", "백", "허", "남", "심", 

15 "노", "하", "곽", "성", "차", "주", "우", "구", "민", "류", 

16 "나", "진", "지", "엄", "채", "원", "천", "방", "공", "현", 

17 "함", "변", "염", "여", "추", "도", "소", "석", "선", "설", 

18 "마", "길", "연", "위", "표", "명", "기", "반", "왕", "금", 

19 "옥", "육", "인", "맹", "제", "모", "탁", "국", "은", "편", 

20 "용", "예", "경", "봉", "사", "부", "가", "복", "태", "목", 

21 "형", "계", "피", "두", 

22 # the two-syllable surnames in current use (census-complete); 

23 # longest-first matching splits 남궁민수 as 남궁+민수, not 남+궁민수 

24 "남궁", "황보", "제갈", "사공", "선우", "서문", "독고", "동방", 

25 "망절", 

26}) 

27""" 

28Korean surnames (#271), used by the 2.0 API's unspaced-name 

29segmentation (``Lexicon.default().surnames``): a hangul token like 

30"김민준" splits into surname + given name by longest match. This ships 

31as DEFAULT vocabulary because it is self-selecting -- a hangul entry 

32can only ever match hangul text -- and hangul text is unambiguously 

33Korean. Chinese surnames deliberately live in ``nameparser.locales.zh`` 

34instead (Han segmentation is opt-in; a zh list corrupts Japanese kanji 

35names). 

36 

37Source: the 2015 South Korean census surname tables -- the most common 

38single-syllable surnames (Kim/Lee/Park alone cover ~45% of the 

39population) plus the two-syllable surnames in current use. A coverage 

40floor, not the complete census roster: extend with 

41``Lexicon.default().add(surnames={...})``. 

42 

43Consumed by the 2.0 parser's default lexicon. The 1.x parser does not 

44read this module. 

45""" 

46 

47 

48assert_normalized("KOREAN_SURNAMES", KOREAN_SURNAMES)