Getting Started

Learn to use word vectors to calculate the semantic similarity of texts programmatically

Photo by Nika Charakova

In a nutshell, word vectors are nothing but the series of real numbers that represent the meanings of natural language words. This technology is an important enabler of useful NLP capabilities that allow machines to “understand” human language. This article discusses how you can use word vectors to programmatically calculate the semantic similarity of texts, which can be useful if you need, for example, to classify those texts based on the topics they cover. …


Photo by Igor Shabalin

If you search for ways to improve your stock investment skills, you’ll definitely find ‘do some research’ among other things.

The decision on whether to buy, sell, or hold the stock is often taken based on emotions, which is definitely not the best strategy. To make balanced choices, you need to raise your logic and decrease your emotions by weighing up the pros and cons of any possible decision. The ability to make informed decisions can help you get ahead of your competition. …


Photo by Dmitry Starinov

It’s quite common nowadays to employ computer technologies to predict stock returns. Thus, many stock prediction algorithms rely on machine learning technology to search patterns and insights in stock data. Before you can do that however, you first need to obtain a data set with necessary stock data and then load it into a data structure in your program. This article covers how you can accomplish those first steps required to get started with stock data analysis in Python.

Getting Stock Data from Yahoo Finance

Where can I get data for analysis? This is perhaps the first question you may have after you decide to perform…


Photo by Igor Shabalin

Sentiment analysis is a task of text classification. In particular, it is about determining whether a piece of writing is positive, negative, or neutral. Having a set of labeled sentences accordingly, you may train a machine learning model that can be then used to make predictions on new sentences. This article illustrates that the process of training such a model can be implemented with just a few lines of code in a Python script that employs the sklearn library.

Loading the Data from a Data Set

In the article example, we’ll take advantage of the Sentiment Labelled Sentences Data Set available from the UCI Machine Learning Repository…


Photo by Igor Shabalin

The process of finding necessary information in the internet manually can be quite time consuming. This article discusses how you might tune your own channel in a messenger to automatically get latest information on the topics of your interest. The idea is the following: you create a bot that will collect information for your channel and then connect this bot to the channel. You need to make the bot available for everyone, so that the results of bot users’ requests come to your channel.

This approach allows you to discover the latest trends, since you will receive the information in…


Photo by Igor Shabalin

Nowadays, the internet has become the main source of information for most of us. When we need to learn about something or master something, we typically go online, using a web search engine like Google to obtain necessary information. Reviewing the retrieved results however, may take considerable time, requiring you to look into each link to see whether the information it contains really suits you. You can significantly shorten your research time when you know exactly what you want to find and can narrow down your search accordingly.

The problem is, though, that sometimes it’s too hard to explain all…


Photo by Ivan Brigida

Everything occurs somewhere. That is why the spatial attributes representing the features of an object can be not less important than its nonspatial attributes when performing data analysis in which that object is involved. As a very simple example, consider taxi ordering via an application. When you order a taxi, you might want to know not only some basic information about the car and the driver assigned to your order but also track their current location on a map while they are heading to you.

Python has a robust ecosystem of pre-existing libraries that can be leveraged in spatial analysis…


Photo by Sergey Arianov

The samples of natural language are typically contextual and mostly driven by intention. So, as a chatbot developer, your primary tasks are to ‘teach’ your bot how to understand the intent and context of what a user says. In my previous article, I touched upon how you can make your bot recognize the context of a sentence being processed, finding the antecedents for substitutes in the previous discourse. In this article, I’ll share some tips on how you can make your bot recognize the intent behind a sentence, using syntactic dependency labels and named entities.

An Example of a User Request

Whether your chatbot is used…


Photo by Igor Shabalin

One of the most challenging tasks in chatbot development is to ‘teach’ the bot to recognize the context of a sentence being processed. Many good designed bots are supposed to understand what stands for pronoun in the current sentence, based on what was said in a discourse previously. Say, a smart bot should understand that in the phrase: ‘What do you know about it?’ ‘it’ is a substitute for a word or a phrase mentioned in one of the previous sentences.

Understanding Substitutes

It’s quite common in natural language to use pronouns in place of nouns, proper nouns, or even entire phrases…


This article discusses how you can analyze official COVID-19 cases data with Python, employing the Pandas library. You’ll see how you can glean insights from actual datasets, discovering information that may not be so obvious at first glance. In particular, the example provided in the article illustrates how you can derive information about the rate of spread of the disease in different countries.

Preparing Your Working Environment

To follow along, you need to have the Pandas library installed in your Python environment. If you don’t have it yet, you can install it with the pip command:

pip install pandas

Then, you’ll need to pick…

Yuli Vasiliev

is the author of Natural Language Processing with Python and spaCy (2020, No Starch Press, https://nostarch.com/NLPPython)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store