🤖AI/ML

Named Entity Recognition

Named Entity Recognition (NER)

An NLP technique that automatically finds and classifies entities with specific meaning in text, such as person names (PER), organizations (ORG), and locations (LOC). A core component of information extraction, search engines, chatbots, and document analysis.

📖 Detailed Explanation

Named Entity Recognition (NER) is a natural language processing technique that automatically finds and classifies entities with specific meanings in text, such as person names (PER), organization names (ORG), location names (LOC), dates/times (DATE), monetary amounts (MONEY), and quantities (QUANTITY). It is a core component of Information Extraction and is widely used in search engines, chatbots, news analysis, and legal/medical document processing.

NER was formally defined in the MUC (Message Understanding Conference) evaluations in the 1990s. Early on, rule-based and dictionary matching approaches were dominant, but in the 2000s CRF (Conditional Random Field) became the standard, and after 2015 BiLSTM-CRF emerged. Currently, Transformer-based models such as BERT and RoBERTa show the best performance, and Zero-shot/Few-shot NER using LLMs such as GPT-4 is also being researched.

NER is defined as a sequence labeling problem. Each token is assigned a label using BIO tagging (B-beginning, I-inside, O-outside) or BIOES (B, I, O, E-end, S-single). For example, in "삼성전자 이재용 회장이 서울에서" ("Samsung Electronics Chairman Lee Jae-yong in Seoul"), "삼성전자" is tagged B-ORG, "이재용" is tagged B-PER, and "서울" is tagged B-LOC.

In practice, NER is essential for contract analysis (automatically extracting parties/amounts/dates), medical record analysis (extracting drug names/symptoms/diagnoses), financial news monitoring (tracking companies/people/events), and customer inquiry analysis (recognizing product/service names). For Korean, handling particles, spacing errors, and compound nouns are additional challenges.

📊 Performance & Cost

Comparison of Major Korean NER Model Performance (as of January 2025)

Model F1 Score Inference speed Parameter Features
KoELECTRA-base 91.2% ~500 sent/s 110M General-purpose Korean NER
KoBERT-NER 89.5% ~400 sent/s 92M Developed by SKT
klue/roberta-large 92.8% ~150 sent/s 337M KLUE benchmark SOTA
spaCy ko_core_news 85.0% ~2000 sent/s 15M Lightweight/fast inference
GPT-4 (Zero-shot) 88.0% ~10 sent/s - No training data required
Claude 3.5 (Few-shot) 90.5% ~15 sent/s - Strong in complex domains

Selection guide: If you need large-scale processing, KoELECTRA is recommended; if you need the highest accuracy, klue/roberta-large; and if domain-specific data is scarce, LLM Zero/Few-shot. LLMs incur API costs ($0.01-0.06/1K tokens).

💻 Code Example

This is a Korean NER example using Hugging Face Transformers.

# pip install transformers torch

from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline

# 한국어 NER 모델 로드
model_name = "Leo97/KoELECTRA-small-v3-modu-ner"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)

# NER 파이프라인 생성
ner_pipeline = pipeline("ner", model=model, tokenizer=tokenizer,
                        aggregation_strategy="simple")

# 분석할 텍스트
texts = [
    "삼성전자 이재용 회장이 서울에서 기자회견을 열었다.",
    "2024년 1월 15일 네이버는 신규 AI 서비스를 발표했다.",
    "애플의 팀 쿡 CEO가 도쿄에서 열린 행사에 참석했다."
]

# NER 수행
for text in texts:
    print(f"원문: {text}")
    entities = ner_pipeline(text)

    for entity in entities:
        print(f"  → {entity['word']}: {entity['entity_group']} "
              f"(신뢰도: {entity['score']:.2%})")
    print()

# 출력 예시:
# 원문: 삼성전자 이재용 회장이 서울에서 기자회견을 열었다.
#   → 삼성전자: ORG (신뢰도: 98.45%)
#   → 이재용: PER (신뢰도: 99.12%)
#   → 서울: LOC (신뢰도: 97.89%)

This is a quick NER example using spaCy.

# pip install spacy
# python -m spacy download ko_core_news_lg

import spacy

# 한국어 모델 로드
nlp = spacy.load("ko_core_news_lg")

text = """
카카오뱅크가 2024년 3월에 서울 강남에서 핀테크 컨퍼런스를 개최한다.
행사에는 김범수 카카오 창업자와 이승건 토스 대표가 참석할 예정이다.
"""

# NER 수행
doc = nlp(text)

# 결과 출력
print("개체명 인식 결과:")
for ent in doc.ents:
    print(f"  {ent.text}: {ent.label_} (위치: {ent.start_char}-{ent.end_char})")

# 출력 예시:
# 개체명 인식 결과:
#   카카오뱅크: ORG (위치: 1-6)
#   2024년 3월: DATE (위치: 8-16)
#   서울 강남: LOC (위치: 18-24)
#   김범수: PER (위치: 50-53)
#   카카오: ORG (위치: 54-57)
#   이승건: PER (위치: 65-68)
#   토스: ORG (위치: 69-71)

This is a Few-shot NER example using an LLM.

# pip install anthropic

import anthropic
import json

client = anthropic.Anthropic()

def extract_entities_with_llm(text: str) -> dict:
    prompt = f"""다음 텍스트에서 개체명을 추출하세요.

개체 유형:
- PER: 인명
- ORG: 기관/회사명
- LOC: 지명
- DATE: 날짜/시간
- MONEY: 금액

예시:
텍스트: "삼성전자 이재용 회장이 2024년 1월 서울에서 10억원 투자를 발표했다."
결과: {{"PER": ["이재용"], "ORG": ["삼성전자"], "LOC": ["서울"], "DATE": ["2024년 1월"], "MONEY": ["10억원"]}}

텍스트: "{text}"
결과:"""

    response = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=500,
        messages=[{"role": "user", "content": prompt}]
    )

    return json.loads(response.content[0].text)

# 사용 예시
text = "LG전자가 2024년 4월 부산 벡스코에서 500억원 규모의 AI 로봇 사업을 공개한다."
entities = extract_entities_with_llm(text)
print(entities)

# 출력: {"PER": [], "ORG": ["LG전자"], "LOC": ["부산 벡스코"], "DATE": ["2024년 4월"], "MONEY": ["500억원"]}

🗣️ Examples of Practical Conversations

💬 In a Meeting

"To automatically extract party names and contract amounts from contracts, you need NER. If you fine-tune KoELECTRA on data specialized for the legal domain, you should get an F1 of 95% or higher. Handling legal terms like '을' and '갑' is especially important."

💬 In an Interview

"We built a medical NER system. It extracts drug names, dosages, and administration methods from prescriptions, and by fine-tuning on a BioBERT basis we achieved an F1 of 0.94 in drug name recognition. We also connect it to a pharmaceutical database and perform normalization as post-processing."

💬 In a Technical Discussion

"In Korean NER, nested entities like '삼성전자 반도체 사업부' (Samsung Electronics Semiconductor Business Division) are a problem. Basic BIO tagging won't work, so you need to approach it with a span-based model or multi-label classification. Or there's also a hierarchical approach where you first recognize the whole and then break it down again."

Take a mock interview on this topic → WIA SOOM AI Interview · Start for free

⚠️ Cautions

❌

Domain Mismatch

Applying a model trained on general news to medical/legal/financial documents significantly degrades performance. This is because domain-specific terms and modes of expression differ.

❌

Ignoring Nested Entities

Many models cannot handle cases where entities are nested, such as "삼성전자 반도체 사업부" (Samsung Electronics Semiconductor Business Division). This is a pattern that occurs frequently in practice.

❌

Sensitivity to Spacing/Typos

Korean NER is sensitive to spacing errors ("서울시" vs "서울 시") and typos. Feeding text into the model without preprocessing degrades performance.

✅

The right way

Fine-tune on domain-specific data and preprocess with a spell checker. If nested NER is needed, use a Span-based model, and adding dictionary-based verification and normalization as post-processing improves accuracy.

🔥 Real-World Incidents

Financial Company A 2022

Customer account wrongly linked due to NER misrecognition

Cause: In a customer inquiry, "김민수" was recognized as a person's name, but it was actually a branch name ("김민수 지점"). It was wrongly linked to the account of a customer with the same name

Impact: Personal information leak, customer complaint, warning from the Financial Supervisory Service

Resolution: Strengthened context-based verification and added post-processing rules for the "~지점" and "~점" patterns

Lesson: Do not trust NER results as they are; especially in sensitive domains such as finance and healthcare, post-processing verification and human review must be used together.

News Media Company B 2023

Wrong article automatically generated due to homonym misrecognition

Cause: NER simply tagged "이영희" as PER, and automatically linked a famous person's profile without distinguishing people with the same name, exposing incorrect information

Impact: Defamation lawsuit, article deletion, loss of credibility

Resolution: Added an Entity Linking pipeline, made human review mandatory when confidence is low

Lesson: NER only tells you "what is an entity"; "who it is" requires Entity Linking. For person names in particular, handling people with the same name is essential.

📝 Comprehension Quiz

Q1. When tagging "삼성전자" in NER, what is the correct BIO label?

Q2. Which of the following is the most widely used metric for evaluating NER performance?

Q3. Which of the following is NOT a method for handling cases where entities are nested, such as "삼성전자 반도체 사업부"?

🔗 Related Terms

📚 Learn More