1. Home
  2. Explore
  3. Computer Science
  4. Natural Language Processing with spaCy

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Natural Language Processing with spaCy

Speaker 1Speaker 2

Natural Language Processing with spaCy

2:50
0:00-2:50
  1. Simon

    Anna, I just finished watching Dr. Mattingly's introduction to NLP and spaCy. He really lays out why natural language processing is so important—getting computers to understand human language from raw text.

  2. Anna

    Absolutely. And he makes a great distinction early on between NLP and natural language understanding. NLP covers things like named entity recognition and part-of-speech tagging, while NLU goes deeper into relation extraction and question answering. They work together in so many industries.

  3. Simon

    Right. And one of the biggest applications he highlights is information extraction. That's where you take unstructured data—like a news article—and pull out structured data, say company names or stock indexes. He's going to show that in part three with financial documents.

  4. Anna

    And the other big one is text classification, like spam detection. Lawyers use it to sort through millions of documents, reducing them to just the relevant ones. That's a real-world use of NLP that saves huge amounts of time.

  5. Simon

    So why does he choose spaCy over other frameworks like NLTK or stanza? He gives four reasons: off-the-shelf models that benchmark really well, support for transformer models, easy custom training, and scalability. It's built by Explosion AI to work at scale with hundreds of thousands of documents.

  6. Anna

    That scalability is a big deal. And he emphasizes that spaCy is great for both rules-based and machine learning approaches. In part two he'll show rules-based pipes like the entity ruler and matcher, and in a possible follow-up he'll cover training your own models.

  7. Simon

    Now let's talk about getting started. First, you install spaCy with pip—or conda—and then download a model. He recommends the small English model 'en_core_web_sm' for this course, and you use the CPU, not GPU, to keep things simple.

  8. Anna

    Once installed, you import spaCy and load the model with `spacy.load('en_core_web_sm')`. That creates an NLP object. Then you pass text to it to get a Doc object. The Doc is the core container in spaCy—it holds all the metadata about your text.

  9. Simon

    And the hierarchy of containers is important. At the top is the Doc, which contains sentences, tokens, and spans. Tokens are individual words or punctuation marks. Spans are sequences of tokens, like a multi-word name 'Martin Luther King'. The Doc, Span, and Token are the three you'll use most.

  10. Anna

    Dr. Mattingly uses a pyramid diagram to show this. The Doc is the big container, and you access sentences via `doc.sents`, tokens by iterating over the Doc, and spans for multi-token entities. It's a clean structure that makes it easy to extract exactly what you need.

  11. Simon

    He also recommends a three-pass learning method: first watch the video for an overview, then code along, then try it on your own without help. That way you really internalize how to use spaCy for your own domain-specific problems.

  12. Anna

    And he mentions a free textbook at spacy.pythonhumanities.com that works alongside the video. Some things are better in text, some in video—so using both is ideal. I think we've got a solid foundation now to dive into the hands-on part of the course.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent