Ein Vokabular erstellen
Jedes Wort einem festen Index zuordnen
Ein Vokabular erstellen ist eine kostenlose NLP Academy-Lektion auf CoddyKit. Dies ist Lektion 2 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 NLP Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der NLP Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
What Is a Vocabulary?
A vocabulary is the full set of unique words your model knows. Each word gets one fixed slot in every document vector. 📖
Collect Every Unique Word
To build it, gather all words across your documents and keep only the distinct ones, dropping repeats.
words = set("the cat sat the mat".split())Give Each Word an Index
Sort the unique words and assign each a number. This word to index map is your vocabulary lookup.
vocab = {w: i for i, w in enumerate(sorted(words))}The Index Defines the Slot
The index tells a word which position it occupies in every vector, so cat always lands in the same column.
Vocabulary Sets Vector Length
If your vocabulary has 5000 words, every document becomes a vector of 5000 numbers, one slot per word.
Order Must Stay Fixed
Once set, the mapping must never change. A stable order guarantees that column 3 means the same word for every document.
Out-of-Vocabulary Words
A word not in your vocabulary is called out of vocabulary. The simplest choice is to ignore it during counting.
Pruning Rare Words
Words that appear once add noise and size. Dropping very rare terms keeps the vocabulary smaller and cleaner.
Dropping Very Common Words
You can also cut words that appear in nearly every document. These stopwords rarely help tell documents apart.
Look Up an Index
With the map built, finding a word position is instant. Just index the dictionary by the word you want.
print(vocab["cat"]) # the column index for catVocabulary Powers Counting
This map is the backbone of vectorization. Next you fill each slot with how often that word appears in a document.
Quick Check
What does a word index represent?
Recap: Your Vocabulary
You built a vocabulary of unique words, mapped each to a fixed index, and saw how pruning keeps it lean and useful. 🎉
Häufig gestellte Fragen
Ist die Lektion „Ein Vokabular erstellen“ kostenlos?
Ja — der vollständige Text von „Ein Vokabular erstellen“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des NLP Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der NLP Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Ein Vokabular erstellen“?
Jedes Wort einem festen Index zuordnen Du übst NLP Academy 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 NLP Academy zu starten?
Keine Vorkenntnisse erforderlich. NLP Academy 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 2 von 4.
Wie lange dauert die Lektion „Ein Vokabular erstellen“?
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 NLP Academy-Lektion Code schreiben und ausführen?
Ja. Jede NLP Academy-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
- Warum Modelle Zahlen statt Wörter benötigen
- Ein Vokabular erstellen
- Mit CountVectorizer zählen
- Die Dokument-Term-Matrix lesen