In this assignment, I apply natural language processing to understand the sentiment in the recent news articles featuring Bitcoin and Ethereum. I apply fundamental NLP techniques to better understand the other factors involved with the coin prices such as common words and phrases and organizations and entities mentioned in the articles.
Objectives:
conda activate base
conda create -n nlpenv python=3.7 -y
conda activate nlpenv
conda install -c anaconda nltk -y
yes | pip install wordcloud
yes | pip install newsapi-python==0.2.5
yes | pip install -U spacy
yes | python -m spacy download en_core_web_sm
yes | pip install alpaca-trade-api
yes | pip install python-dotenv
conda install -c conda-forge python-dotenv
sudo python -m nltk.downloader -d /usr/local/share/nltk_data all
pip install jupyterlab_sublime
Using the newsapi, I pull the latest news articles for Bitcoin and Ethereum and create a DataFrame of sentiment scores for each coin.
Using descriptive statistics, I address the following questions:
Which coin had the highest mean positive score?
Which coin had the highest negative score?
Which coin had the highest positive score?
In this section, I use NLTK and Python to tokenize text, find n-gram counts, and create word clouds for both coins.
- Lowercase each word.
- Remove punctuation.
- Remove stop words.
Next, I look at the ngrams and word frequency for each coin.
- Use NLTK to produce the ngrams for N = 2.
- List the top 10 words for each coin.
Finally, I generate word clouds for each coin to summarize the news for each coin.
In this section, I build a named entity recognition model for both coins and visualize the tags using SpaCy.
The free developer version of the News API limits the total daily requests, so repeated API calls during testing should be limited.