원본 데이터 정리 및 중복 제거
수집 전에 잡음이 많은 문서를 정리하고 중복 콘텐츠를 제거하여 RAG 인덱스를 작고 정확하게 유지하며 서로 충돌하는 답변이 생기지 않도록 합니다.
원본 데이터 정리 및 중복 제거은(는) CoddyKit의 무료 LLM Apps in Production (RAG + Vector DB + Caching) 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 LLM Apps in Production (RAG + Vector DB + Caching) 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. LLM Apps in Production (RAG + Vector DB + Caching) 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Garbage In, Garbage Out
RAG quality is capped by the quality of what you ingest. Boilerplate, HTML tags, duplicate pages, and broken encoding all pollute retrieval.
Cleaning and deduplication happen before chunking and embedding.
Common Noise Sources
Typical junk found in raw documents:
- Navigation menus, headers, footers
- Cookie banners and ads
- Repeated legal disclaimers
- Mojibake from bad encoding
- Excess whitespace and control chars
Basic Text Normalization
Normalize whitespace and strip control characters first.
import re
def clean(text):
text = re.sub(r'[\t\r]+', ' ', text)
text = re.sub(r' {2,}', ' ', text)
text = re.sub(r'\n{3,}', '\n\n', text)
return text.strip()
print(clean('Hello world\n\n\n\nbye'))Stripping Boilerplate
Remove repeated boilerplate that appears on many pages. A simple approach: collect lines that repeat across documents and drop them.
- Footers, copyright lines
- Share-this widgets
- Identical navigation blocks
Fixing Encoding Issues
Mojibake like 'caf\u00c3\u00a9' instead of 'caf\u00e9' confuses embeddings. Detect the source encoding and decode consistently to UTF-8 before storage.
Exact Duplicate Detection
The cheapest dedup: hash the normalized text and drop exact repeats.
import hashlib
seen = set()
def is_dup(text):
h = hashlib.sha256(text.encode()).hexdigest()
if h in seen:
return True
seen.add(h)
return False
print(is_dup('a'))
print(is_dup('a'))Near-Duplicate Detection
Exact hashing misses pages that differ by a date or a word. Use near-duplicate techniques:
- MinHash + Jaccard similarity
- SimHash fingerprints
- Embedding cosine similarity above a threshold
Jaccard Similarity
A quick token-set overlap score to flag near-duplicates.
def jaccard(a, b):
sa, sb = set(a.split()), set(b.split())
return len(sa & sb) / len(sa | sb)
print(round(jaccard('the cat sat', 'the cat ran'), 2))Why Duplicates Hurt RAG
Duplicate chunks waste index space and skew retrieval: the top-k results fill up with copies of the same passage, crowding out diverse evidence. Conflicting near-duplicates (old vs new policy) can even produce contradictory answers.
Building a Cleaning Pipeline
Chain the steps in order: normalize -> fix encoding -> strip boilerplate -> exact dedup -> near dedup. Log how much was removed so you can audit aggressive filters.
Idempotent Re-ingestion
When documents are re-ingested, use a stable content hash as the record key so updates replace the old version instead of creating duplicates. This keeps the index clean over time.
Quick Check
Test your understanding of deduplication.
Recap
You learned to prepare clean source data: normalize text, fix encoding, strip boilerplate, then remove both exact and near-duplicates. Use stable content hashes for idempotent re-ingestion. Cleaner inputs mean a smaller index and more accurate, non-contradictory retrieval.
자주 묻는 질문
“원본 데이터 정리 및 중복 제거” 강의는 무료인가요?
네 — “원본 데이터 정리 및 중복 제거” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 LLM Apps in Production (RAG + Vector DB + Caching) 강의 전체를 잠금 해제할 수 있습니다. LLM Apps in Production (RAG + Vector DB + Caching) 강의에는 총 4개의 강의가 포함되어 있습니다.
“원본 데이터 정리 및 중복 제거”에서 뭘 배우나요?
수집 전에 잡음이 많은 문서를 정리하고 중복 콘텐츠를 제거하여 RAG 인덱스를 작고 정확하게 유지하며 서로 충돌하는 답변이 생기지 않도록 합니다. 브라우저에서 직접 실행하는 실습 코드로 LLM Apps in Production (RAG + Vector DB + Caching)을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
LLM Apps in Production (RAG + Vector DB + Caching)을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 LLM Apps in Production (RAG + Vector DB + Caching)은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“원본 데이터 정리 및 중복 제거” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 LLM Apps in Production (RAG + Vector DB + Caching) 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 LLM Apps in Production (RAG + Vector DB + Caching) 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 다양한 문서 형식 불러오기
- 컨텍스트 인식 텍스트 분할 전략
- 메타데이터 관리와 필터링
- 원본 데이터 정리 및 중복 제거