Skip to content

Free-tek/Anjie_local_language_corpus_generator

Repository files navigation

This python library provides corpus in English and various local african languages e.g(Youruba, Hausa, Pidgin) by scraping several online newspaper websites, it also does sentiment analysis on brands and can tell you if your brand is looking good or bad from various media publications.

USAGE

Brand Sentiment Analysis

This method helps you scrape news from 7 online english written newspapers and blogs for a particular organisation or brand and can run sentiment analysis to tell you how the brand is percieved in the news.

The list of online newspapers this script scrapes from is
Punch
The Nation Newspaper
The Guardian Newspaper
BBC
Lindaikeji's blog
News24

Most recent developments to this library will allow you scrape news from various news papers and blogs across the world and we hope that you use the corpus you generate to do some awesome machine learning tasks.
Brand analaysis on Donald Trump

https://pypi.org/project/anjie-adewole63/0.0.1/


HELP
brand = "MTN" #the name of the brand you will like to perfrom sentiment analysis on e.gcsvFileName = The name of the csv file you will like to save your output to, default is brandNews.csv. (optional parameter)
from anjie import brandSentimentAnalysis
brandSentimentAnalysis.anjie_brands(brand = "MTN", csvFileName = 'brandNews')
import pandas as pd
df = pd.read_csv("brandNews.csv.csv")

Scraping English Corpus

noRows = 2 The number of rows of news you want.
csvFileName = "my_result.csv" The name of the csv file you will like to save your output to, default is news.csv. (optional parameter)
News categories include ['news', 'sports', 'metro-plus', 'politics', 'business', 'entertainment', 'editorial', 'columnist']
removeCategories = [] :as a parameter for news categories you don't want in the scraped corpus. (optional parameter) e.g.

englishCorpus.scrape(noRows = 150, removeCategories = ['metro-plus', 'politics']) 

pass onlyCategories = [] : as a parameter for only categories you want in the scraped corpus. (optional parameter) e.g ,

englishCorpus.scrape(noRows = 150, onlyCategories = ['news', 'sports', 'metro-plus', 'entertainment', 'editorial', 'columnist'])
from anjie import englishCorpus
englishCorpus.scrape(noRows = 150)
df = pd.read_csv("news.csv")

Scraping Hausa Corpus
noRows = 2 The number of rows of news you want. only 60 rows of hausa corpus is currently available.
csvName = "my_result.csv" The name of the csv file you will like to save your output to, default is hausa_news.csv. (optional parameter)

from anjie import hausaCorpus
hausaCorpus.scrape(noRows = 10)
import pandas as pd
df = pd.read_csv("hausa_news.csv")

Scraping Pidgin English corpus
noRows = 2 The number of rows of news you want.
csvFileName = "my_result.csv" The name of the csv file you will like to save your output to, default is pidgin_corpus.csv. (optional parameter)
News categories include ['nigeria', 'africa', 'sport', 'entertainment']
removeCategories = [] :as a parameter for news categories you dont want in the scraped corpus. (optional parameter) e.g , englishCorpus.scrape(noRows = 150, removeCategories = ['entertainment'])

pass onlyCategories = [] : as a parameter for only categories you want in the scraped corpus. (optional parameter) e.g , englishCorpus.scrape(noRows = 150, onlyCategories = ['nigeria','sport', 'entertainment'])

from anjie import pidginCorpus
pidginCorpus.scrape(noRows = 20)
df = pd.read_csv("pidgin_corpus.csv")

Scraping Yoruba Corpus
noRows = 2 The number of rows of news you want.
csvFileName = "my_result.csv" The name of the csv file you will like to save your output to, default is yoruba_corpus.csv. (optional parameter)

from anjie import yorubaCorpus
yorubaCorpus.scrape(noRows = 20)
df = pd.read_csv("yoruba_corpus.csv")

Installation Available for install on python >= 3.6

$pip install anjie

Github link for project - https://github.com/Free-tek/Anjie_local_language_corpus_generator

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published