0Pricing
NLP Academy · Lesson

Building a Positive and Negative Word List

Your sentiment lexicon.

Building a Positive and Negative Word List is a free NLP Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the NLP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Meet the Lexicon

A lexicon is simply a list of words tagged with sentiment. It is the dictionary your rule-based detector will look words up in. 📖

Two Buckets to Start

Begin with two lists: positive words and negative words. Each list holds terms that reliably signal one feeling on their own.

Positive Words

Fill the positive set with words readers say when happy: good, great, love, excellent, amazing. Keep them lowercase for easy matching.

positive = {"good", "great", "love", "excellent", "amazing"}

Negative Words

The negative set collects complaint words: bad, awful, hate, terrible, broken. These are the red flags your detector hunts for.

negative = {"bad", "awful", "hate", "terrible", "broken"}

Why Use a Set

A Python set checks membership instantly, so testing if a word is positive stays fast even when your lists grow large.

Lowercase Everything

Great and GREAT should match the same entry, so store words lowercased and lowercase incoming text too. This keeps matching consistent.

Checking a Word

Looking a word up is one line. The in operator tells you instantly whether a term lives in your positive list.

word = "love"
is_pos = word in positive

Borrow a Ready Lexicon

You do not have to start blank. Tools like NLTK ship curated opinion lexicons with thousands of scored words you can reuse.

Watch for Overlap

A word should not sit in both lists, so keep your sets disjoint. Conflicts make scoring ambiguous and confuse your final label.

Domain Matters

Sentiment is domain-specific. For a hotel, quiet is positive; for a party, it is not. Tune the lexicon to your specific use case.

Keep It Growing

Treat your lists as living data. When the detector misses a clear cue, just add that word, so the lexicon steadily improves over time.

Quick Check

Think about why we chose this data structure.

Recap

You built a lexicon: positive and negative word sets, lowercased and disjoint, for fast lookups. You can borrow NLTK lists and tune them per domain. Next we score full reviews. ✅

Frequently asked questions

Is the “Building a Positive and Negative Word List” lesson free?

Yes — the full text of “Building a Positive and Negative Word List” is free to read here on the web, and the NLP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the NLP Academy course, upgrade to CoddyKit PRO.

What will I learn in “Building a Positive and Negative Word List”?

Your sentiment lexicon. You practise NLP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start NLP Academy?

No prior experience is required. NLP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Building a Positive and Negative Word List” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this NLP Academy lesson?

Yes. Every NLP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Is Sentiment Analysis?
  2. Building a Positive and Negative Word List
  3. Scoring a Review by Counting Cues
  4. Handling Negation and Edge Cases
← Back to NLP Academy