SpaCy Vs NLTK – Basic NLP Operations code and result comparison

In this article we are going to explore the code of basic NLP operations using NLTK and spaCy.

Source: Photo by Amador Loureiro on Unsplash

NLTK

NLTK is an open-source library and it is very suitable for teaching, and working in, computational linguistics using Python.

Also it is having industrialm strength libraries.

spaCy

spaCy is an open-source library for advanced NLP in python.

It is specially designed for production use, which can handle large volume of text where as NLTK and CoreNLP were created specially for teaching and research purpose.

spaCy provides advanced NLP techniques which is widely used in complex applications such as text summarization, text to speech, domain specific NER, Q&A, Emotion Detection etc.

I am planning to explore one-by-one and share it with you in a series of posts.

First Releases

Open-Source LibraryYear of First Release
spaCy2015
NLTK2001

It is widely mentioned in many blog posts and articles that spaCy is faster, has almost all the features that is provided by other libraries (NLTK, CodeNLP etc). But more or less similar accuracy.

In this article we are going to analyze and compare code for the very basic operations of NLP in spaCy and NLTK.

And we are not going to compare the speed and accuracy of these libraries. However, knowing the code and results from these two libraries may help in future researches.

Word Tokenization

Output:

Sentence Tokenization

Output:

Output:

Stopword Removal

Output:

Output:

POS Tagging

Output:

Output:

Named Entity Recognization

Output:

Output:

Output:

Conclusion:

Now we have seen how the basic NLP operations can be done in both NLTK and SpaCy. It will be useful and easy to compare the source codes to understand the basic features of two libraries.

We will see more about NLP techniques and its applications in this series.

Thank you for reading our article and hope you enjoyed it. 😊 Try all these techniques and play with words.

Like to support? Just click the like button ❤️.

Happy Learning! 👩‍💻

1+

Leave a Reply

Your email address will not be published. Required fields are marked *