refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
---
|
||||
id: wiki-2026-0508-linguistic-analysis-in-ai
|
||||
title: Linguistic Analysis in AI
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [NLP Linguistic Analysis, Syntactic Analysis, Linguistic Features]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.85
|
||||
verification_status: applied
|
||||
tags: [nlp, ai, linguistics, parsing, ner, llm]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack: { language: python, framework: 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 표준 파이프라인
|
||||
```python
|
||||
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 (다국어 정확도)
|
||||
```python
|
||||
import stanza
|
||||
nlp = stanza.Pipeline('ko', processors='tokenize,pos,lemma,depparse,ner')
|
||||
doc = nlp(text)
|
||||
```
|
||||
|
||||
### Pattern 3 — LLM zero-shot NER
|
||||
```python
|
||||
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 기반 관계 추출
|
||||
```python
|
||||
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)
|
||||
```python
|
||||
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 검증)
|
||||
```python
|
||||
# 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
|
||||
- 부모: [[Natural-Language-Processing-NLP|Natural-Language-Processing]], [[Computational-Linguistics]]
|
||||
- 변형: [[NER]]
|
||||
- 응용: [[Information-Extraction]], [[Knowledge Graph|Knowledge-Graph]], [[RAG]]
|
||||
- Adjacent: [[Tokenization]], [[Word-Embeddings]]
|
||||
|
||||
## 🤖 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 |
|
||||
Reference in New Issue
Block a user