단어 경계
Embed This Widget
Add the script tag and a data attribute to embed this widget.
Embed via iframe for maximum compatibility.
<iframe src="https://unicodefyi.com/iframe/glossary/word-boundary/" width="420" height="400" frameborder="0" style="border:0;border-radius:10px;max-width:100%" loading="lazy"></iframe>
Paste this URL in WordPress, Medium, or any oEmbed-compatible platform.
https://unicodefyi.com/glossary/word-boundary/
Add a dynamic SVG badge to your README or docs.
[](https://unicodefyi.com/glossary/word-boundary/)
Use the native HTML custom element.
유니코드 단어 경계 규칙에 따라 결정된 단어 사이의 위치. 단순히 공백으로 분리하는 것이 아니라 CJK(공백 없음), 줄임말, 숫자를 올바르게 처리합니다.
What is a "Word"?
English speakers intuitively know where words start and end: spaces and punctuation serve as dividers. But for a computer processing multilingual text, "word" is a surprisingly complex concept. Chinese, Japanese, and Thai use no spaces between words. German compounds like "Donaudampfschifffahrtsgesellschaft" are single orthographic words. English contractions like "don't" and "I've" may be one or two tokens depending on the application.
UAX #29 Word Boundary rules provide an algorithmic definition of word boundaries that works reasonably across scripts, suitable for applications that need to tokenize text, implement double-click selection, count words, or process natural language.
Word Boundary Rules Overview
The UAX #29 word boundary algorithm assigns each character to a word break property and applies a table of rules to determine if a boundary exists between adjacent characters. Key properties:
| Property | Examples | Meaning |
|---|---|---|
| Letter | A–Z, a–z, accented letters | Part of a word |
| Numeric | 0–9 | Part of a numeric run |
| MidLetter | ' · |
Allowed within a word (contractions) |
| MidNum | , . |
Allowed within a number (1,000 or 3.14) |
| ExtendNumLet | _ |
Word extender (identifiers) |
| WSegSpace | regular spaces | Word boundary position |
| Newline | CR, LF, NEL | Word boundary position |
Notable rules:
- Contractions: don't is ONE word token because apostrophe (MidLetter) between two Letter characters is not a boundary.
- Numbers: 3.14 and 1,000 are single tokens because . and , between digits are MidNum characters.
- Identifiers: my_variable is one token because _ is ExtendNumLet.
- Email/URL: UAX #29 has special rules to keep [email protected] as tokens.
CJK and Scripts Without Spaces
For Chinese, Japanese, and Thai, UAX #29 uses a simplified approach: every character is its own "word" at the UAX #29 level. Real word segmentation for these scripts requires language-specific processing (statistical models, dictionaries):
# UAX #29 treats each CJK character as a separate word token
# For real Japanese segmentation, use MeCab or SudachiPy
# For real Chinese, use jieba or pkuseg
# For real Thai, use PyThaiNLP
import jieba # pip install jieba
tokens = list(jieba.cut("我喜欢学习自然语言处理"))
print(tokens) # ['我', '喜欢', '学习', '自然语言处理']
Python and ICU Word Segmentation
from icu import BreakIterator, Locale, RuleBasedBreakIterator
text = "Don't stop, it's 3.14 o'clock. [email protected]"
bi = BreakIterator.createWordInstance(Locale("en_US"))
bi.setText(text)
start = 0
for end in bi:
token = text[start:end]
rule_status = bi.getRuleStatus()
# rule_status == 200-299: word (letter-based)
# rule_status == 100-199: number
# rule_status == 0: non-word (space/punctuation)
if rule_status != 0:
print(f"word: {repr(token)}")
start = end
Quick Facts
| Property | Value |
|---|---|
| Specification | UAX #29, Section 4 (Word Boundaries) |
| Contractions | Apostrophe between letters is NOT a boundary |
| CJK text | No inter-character breaks by default — language tools needed |
| Thai | No space-based segmentation — requires dictionary/ML approach |
| Double-click selection | Should use word boundary algorithm |
| Search engines | Use language-specific tokenizers, not raw UAX #29 |
| Python ICU | BreakIterator.createWordInstance(Locale("en_US")) |
관련 용어
알고리즘의 더 많은 용어
Mapping characters to a common case form for case-insensitive comparison. More comprehensive …
Rules (UAX#29) for determining where one user-perceived character ends and another begins. …
정규화 형식 C: 분해 후 정규 재합성하여 가장 짧은 형식을 생성합니다. 데이터 …
정규화 형식 D: 재합성 없이 완전히 분해합니다. macOS HFS+ 파일 시스템에서 사용됩니다. …
정규화 형식 KC: 호환 분해 후 정규 합성. 시각적으로 유사한 문자를 통합합니다(fi→fi, …
정규화 형식 KD: 재합성 없이 호환 분해. 가장 강력한 정규화 방식으로 서식 …
Comparing Unicode strings requires normalization (NFC/NFD) and optionally collation (locale-aware sorting). Binary …
유니코드 규칙에 따른 문장 사이의 위치. 마침표로만 분리하는 것보다 복잡하며, 약어(Mr.), 생략 …
문자 양방향 범주와 명시적 방향 재정의를 사용하여 혼합 방향 텍스트(예: 영어 + …
유니코드 텍스트를 표준 정규 형식으로 변환하는 과정. 네 가지 형식: NFC(합성), NFD(분해), …