Introduction to SpaCy

Python ile Doğal Dil İşlemeye Giriş

Katharine Jarmul

Founder, kjamistan

What is SpaCy?

  • NLP library similar to gensim, with different implementations
  • Focus on creating NLP pipelines to generate models and corpora
  • Open-source, with extra libraries and tools
    • Displacy
Python ile Doğal Dil İşlemeye Giriş

Displacy entity recognition visualizer

Python ile Doğal Dil İşlemeye Giriş
import spacy

nlp = spacy.load('en_core_web_sm')
nlp.entity
<spacy.pipeline.EntityRecognizer at 0x7f76b75e68b8>
doc = nlp("""Berlin is the capital of Germany; 
                  and the residence of Chancellor Angela Merkel.""")

doc.ents
(Berlin, Germany, Angela Merkel)
print(doc.ents[0], doc.ents[0].label_)
Berlin GPE
Python ile Doğal Dil İşlemeye Giriş

Why use SpaCy for NER?

  • Easy pipeline creation
  • Different entity types compared to nltk
  • Informal language corpora
    • Easily find entities in Tweets and chat messages
  • Quickly growing!
Python ile Doğal Dil İşlemeye Giriş

Let's practice!

Python ile Doğal Dil İşlemeye Giriş

Preparing Video For Download...