Twitter is one of the most popular social media platforms. Due to its simplicity of use and the services provided by twitter API, it is extensively used around the world, including Morocco. It provides huge volume of information and is considered as a large source of data for opinion mining.
The aim of this paper is to analyze Moroccan tweets, in order to generate some useful statistics, identify different sentiments, and extract then visualize predominant topics. In our research work, we collected 25 146 tweets using Twitter API and python language, and stored them into MongoDB database. Stored tweets were preprocessed by applying natural language processing techniques (NLP) using NLTK library. Then, we performed sentiment analysis which classifies the polarity of twitter comments into negative, positive, and neutral categories. Finally, we applied topic modeling over the tweets to obtain meaningful data from Twitter, comparing and analyzing topics detected by two popular topic modeling algorithms; Non-negative Matrix Factorization (NMF) and Latent Dirichlet Allocation (LDA). The observed results show that LDA outperforms NMF in terms of their topic coherence.