Files
2nd/10_Wiki/Topics/AI_and_ML/Linguistic-Analysis-in-AI.md
T
Antigravity Agent f8b21af4be Wiki cleanup: error-doc removal, dedup merge, link normalization
10_Wiki/Topics 대규모 정리:
- 오류 캡처/미완성 stub 문서 227개 제거
- 교차폴더 중복 43클러스터 병합 (63파일 → redirect)
- 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건
- 카테고리 MOC 6개 신규 생성
- Graph 섹션 미해결 related-keyword 링크 10,058건 제거

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 23:52:15 +09:00

4.4 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-linguistic-analysis-in-ai Linguistic Analysis in AI 10_Wiki/Topics verified self
NLP Linguistic Analysis
Syntactic Analysis
Linguistic Features
none A 0.85 applied
nlp
ai
linguistics
parsing
ner
llm
2026-05-10 pending
language framework
python spacy-stanza-llm

Linguistic Analysis in AI

매 한 줄

"매 LLM 시대에도 구조 분석은 살아있다". POS/dependency/NER 같은 전통 분석은 여전히 정보 추출·검색·평가에 쓰이지만, 2026엔 LLM이 zero-shot으로 대부분 대체.

매 핵심

매 분석 단계

  • Tokenization: 단어/subword 분리.
  • POS tagging: 품사 (NOUN, VERB, ADJ).
  • Lemmatization / Stemming: 어간 정규화.
  • Dependency parsing: 단어 간 문법 관계 트리.
  • Constituency parsing: 구 구조 (NP, VP).
  • NER: Named Entity Recognition (PER, ORG, LOC).
  • SRL: Semantic Role Labeling (agent, patient).
  • Coreference: 대명사 해결.

매 응용

  1. 정보 추출 (KG 구축, relation extraction).
  2. 검색 쿼리 재작성, 의도 파싱.
  3. RAG에서 entity 기반 chunking.
  4. 평가 (LLM 출력의 grammaticality, faithfulness).
  5. 저자원 언어 도구 체인.
  6. 데이터 정제 / privacy redaction (NER로 PII 마스킹).

💻 패턴

Pattern 1 — spaCy 표준 파이프라인

import spacy
nlp = spacy.load('ko_core_news_lg')
doc = nlp("애플은 2026년 비전 프로 2를 출시했다.")
for tok in doc:
    print(tok.text, tok.pos_, tok.dep_, tok.head.text)
for ent in doc.ents:
    print(ent.text, ent.label_)

Pattern 2 — Stanza (다국어 정확도)

import stanza
nlp = stanza.Pipeline('ko', processors='tokenize,pos,lemma,depparse,ner')
doc = nlp(text)

Pattern 3 — LLM zero-shot NER

from anthropic import Anthropic
client = Anthropic()
resp = client.messages.create(
    model='claude-opus-4-7',
    messages=[{'role':'user','content':
        f'Extract entities as JSON [{{"text","type"}}]:\n{text}'}],
    max_tokens=1024,
)

Pattern 4 — Dependency 기반 관계 추출

for tok in doc:
    if tok.dep_ == 'nsubj' and tok.head.pos_ == 'VERB':
        print('subject:', tok.text, '->', tok.head.text)

Pattern 5 — PII Redaction (NER)

def redact(text):
    doc = nlp(text)
    out = text
    for ent in reversed(doc.ents):
        if ent.label_ in {'PERSON','GPE','PHONE'}:
            out = out[:ent.start_char] + f'[{ent.label_}]' + out[ent.end_char:]
    return out

Pattern 6 — Hybrid (LLM + parser 검증)

# LLM으로 빠르게 추출 → spaCy로 검증/정렬
candidates = llm_extract(text)
doc = nlp(text)
verified = [c for c in candidates if any(c['text']==e.text for e in doc.ents)]

매 결정 기준

상황 도구
대량 / 저예산 / 정형 spaCy / Stanza
정확도 우선 다국어 Stanza, Trankit
Zero-shot, 도메인 특수 LLM (Claude/GPT)
실시간 latency spaCy small model
학습 데이터 라벨링 LLM weak supervision + 검수
Production NER 한국어 KoNLPy + spaCy ko 또는 LLM

기본값: 2026 - LLM zero-shot이 default, spaCy는 비용 민감/대량 처리에.

🔗 Graph

🤖 LLM 활용

언제:

  • 짧은 텍스트 entity/relation 추출 (zero-shot).
  • spaCy/Stanza 파이프라인 코드 생성.
  • 한국어/저자원 언어 빠른 프로토타입.

언제 X:

  • 100M doc 배치 (비용 - 전통 도구가 100배 저렴).
  • 결정론적 재현성 필수 (LLM 비결정성).

안티패턴

  • LLM에 토크나이저 정보 의존 (모델별 상이).
  • 영어 모델로 한국어 NER (도메인 mismatch).
  • Dependency tree 결과를 ground truth로 (parser도 ~92%).
  • 모든 문제에 LLM (단순 POS 태깅에 GPT-4 호출은 낭비).
  • Tokenization 영향 무시 (subword가 단어 경계 깨짐).

🧪 검증 / 중복

  • Verified. spaCy 3.7+/Stanza 1.8 기준. 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup