0Pricing
LLM Apps in Production (RAG + Vector DB + Caching) · Lektion

Quelldaten bereinigen und deduplizieren

Lernen Sie, verrauschte Dokumente zu bereinigen und doppelte Inhalte vor der Aufnahme zu entfernen, damit Ihr RAG-Index klein und präzise bleibt und keine widersprüchlichen Antworten liefert.

Quelldaten bereinigen und deduplizieren ist eine kostenlose LLM Apps in Production (RAG + Vector DB + Caching)-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des LLM Apps in Production (RAG + Vector DB + Caching)-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der LLM Apps in Production (RAG + Vector DB + Caching)-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

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.

Häufig gestellte Fragen

Ist die Lektion „Quelldaten bereinigen und deduplizieren“ kostenlos?

Ja — der vollständige Text von „Quelldaten bereinigen und deduplizieren“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des LLM Apps in Production (RAG + Vector DB + Caching)-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der LLM Apps in Production (RAG + Vector DB + Caching)-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Quelldaten bereinigen und deduplizieren“?

Lernen Sie, verrauschte Dokumente zu bereinigen und doppelte Inhalte vor der Aufnahme zu entfernen, damit Ihr RAG-Index klein und präzise bleibt und keine widersprüchlichen Antworten liefert. Du übst LLM Apps in Production (RAG + Vector DB + Caching) mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um LLM Apps in Production (RAG + Vector DB + Caching) zu starten?

Keine Vorkenntnisse erforderlich. LLM Apps in Production (RAG + Vector DB + Caching) auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.

Wie lange dauert die Lektion „Quelldaten bereinigen und deduplizieren“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser LLM Apps in Production (RAG + Vector DB + Caching)-Lektion Code schreiben und ausführen?

Ja. Jede LLM Apps in Production (RAG + Vector DB + Caching)-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Verschiedene Dokumentformate laden
  2. Kontextabhängige Strategien zur Textaufteilung
  3. Metadatenverwaltung und Filterung
  4. Quelldaten bereinigen und deduplizieren
← Zurück zu LLM Apps in Production (RAG + Vector DB + Caching)