Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Natural Language Processing and Computational Linguistics

You're reading from  Natural Language Processing and Computational Linguistics

Product type Book
Published in Jun 2018
Publisher Packt
ISBN-13 9781788838535
Pages 306 pages
Edition 1st Edition
Languages
Author (1):
Bhargav Srinivasa-Desikan Bhargav Srinivasa-Desikan
Profile icon Bhargav Srinivasa-Desikan

Table of Contents (22) Chapters

Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
1. What is Text Analysis? 2. Python Tips for Text Analysis 3. spaCy's Language Models 4. Gensim – Vectorizing Text and Transformations and n-grams 5. POS-Tagging and Its Applications 6. NER-Tagging and Its Applications 7. Dependency Parsing 8. Topic Models 9. Advanced Topic Modeling 10. Clustering and Classifying Text 11. Similarity Queries and Summarization 12. Word2Vec, Doc2Vec, and Gensim 13. Deep Learning for Text 14. Keras and spaCy for Deep Learning 15. Sentiment Analysis and ChatBots 1. Other Books You May Enjoy Index

Garbage in, garbage out


Garbage in, garbage out (or GIGO) is an adage of computer science which is even more important when dealing with machine learning and possibly even more so when dealing with textual data. Garbage in, garbage out means that if we have poorly formatted data, it is likely we will have poor results.

Fig 1.5 XKCD hits the hammer on the nail once again (https://xkcd.com/1838/)

While more data usually leads to a better prediction, it isn't always the same case with text analysis, where more data can result in nonsense results or results which we don't always want. An intuitive example: the part of speech, articles, such as the words a, or the tend to appear a lot in text, but not adding any information to the text, and is usually limited to grammar or structure.

Words such as these which don't provide useful information are called stop words, and these words are often removed from the text before applying text analysis techniques on them. Similarly, sometimes we remove words with very high frequency in the body of text, and words which only appear once or twice – it is highly likely these words will not be useful to our analysis. That being said, this depends heavily on the kind of task being performed - if, for example, we would want to replicate human writing styles, stop words are important because humans many such words when writing. An example of how stop words can also include useful information is in this article, Pastiche detection based on stopword rankings. Exposing impersonators of a Romanian writer [20], is a study identified a certain author using frequency of stop words.

Let's consider another example where we might be dealing with useless data – if searching for influential words or topics in the text, would it make sense to have both the words reading and read in the results? Here, shortening the word reading to read would not lead to any loss of information. But on a similar note, it would make sense to have the words information and inform exist separately in the same body of text, because they could mean different things based on the context. We would then need techniques to shorten words appropriately. Lemmatizing and stemming are two methods we use to tackle this problem and remain two of the core concepts in natural language processing. We will be exploring these two techniques in more detail in Chapter 3, spaCy's Language models.

Even after basic text-processing, our data is still a collection of words. Since machines do not inherently understand the concepts tied to words, we can instead use numbers that represent individual words. The next important step in text analysis is converting words into numbers, whether it is bag-of-words (BOW), or term frequency-inverse document frequency (TF-IDF), which are different ways to count the number of words in each document or sentence. There are also more advanced techniques to represent words such as Word2Vec and GloVe.

We will go into these details and techniques in more detail in the chapter on pre-processing techniques – it is especially important to understand the motivation behind these techniques, and that a computer's output is only as good as the input you feed it.

You have been reading a chapter from
Natural Language Processing and Computational Linguistics
Published in: Jun 2018 Publisher: Packt ISBN-13: 9781788838535
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}