Skip to content

Commit

Permalink
Week 9 2023. (#523)
Browse files Browse the repository at this point in the history
Closes #521.
  • Loading branch information
jonthegeek authored Feb 26, 2023
1 parent 9337d8e commit d692fe5
Show file tree
Hide file tree
Showing 13 changed files with 112,064 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Need a **reminder**? There are [extensions](https://chrome.google.com/webstore/d
| 6 | `2023-02-07` | [Big Tech Stock Prices](data/2023/2023-02-07/readme.md) | [Big Tech Stock Prices on Kaggle](https://www.kaggle.com/datasets/evangower/big-tech-stock-prices) | [5 Charts on Big Tech Stocks’ Collapse](https://www.morningstar.com/articles/1129535/5-charts-on-big-tech-stocks-collapse) |
| 7 | `2023-02-14` | [Hollywood Age Gaps](data/2023/2023-02-14/readme.md) | [Hollywood Age Gap](https://hollywoodagegap.com/movies.csv) | [Hollywood Age Gap](https://hollywoodagegap.com/) |
| 8 | `2023-02-21` | [Bob Ross Paintings](data/2023/2023-02-21/readme.md) | [Bob Ross Paintings data](https://github.com/jwilber/Bob_Ross_Paintings/blob/master/data/bob_ross_paintings.csv) | [Bob Ross Colors data package](https://github.com/frankiethull/BobRossColors) |
| 9 | `2023-02-28` | [African Language Sentiment](data/2023/2023-02-28/readme.md) | [AfriSenti: Sentiment Analysis dataset for 14 African languages](https://github.com/afrisenti-semeval/afrisent-semeval-2023) | [AfriSenti: A Twitter Sentiment Analysis Benchmark for African Languages](https://arxiv.org/pdf/2302.08956.pdf) |

***

Expand Down
111,721 changes: 111,721 additions & 0 deletions data/2023/2023-02-28/afrisenti.csv

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions data/2023/2023-02-28/country_regions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
country,region
Algeria,North Africa
Cameroon,West Africa
Eswatini,Southern Africa
Ethiopia,East Africa
Ghana,West Africa
Kenya,East Africa
Morocco,Northern Africa
Mozambique,East Africa
Mozambique,Southeastern Africa
Mozambique,Southern Africa
Nigeria,West Africa
Rwanda,East Africa
South Africa,Southern Africa
Tanzania,East Africa
Zimbabwe,Southern Africa
24 changes: 24 additions & 0 deletions data/2023/2023-02-28/language_countries.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language_iso_code,country
amh,Ethiopia
arq,Algeria
ary,Morocco
hau,Cameroon
hau,Ghana
hau,Nigeria
ibo,Nigeria
kin,Rwanda
orm,Ethiopia
pcm,Cameroon
pcm,Ghana
pcm,Nigeria
pt-MZ,Mozambique
swa,Kenya
swa,Mozambique
swa,Tanzania
tir,Ethiopia
tso,Eswatini
tso,Mozambique
tso,South Africa
tso,Zimbabwe
twi,Ghana
yor,Nigeria
16 changes: 16 additions & 0 deletions data/2023/2023-02-28/language_scripts.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language_iso_code,script
amh,Ethiopic
arq,Arabic
ary,Arabic
ary,Latin
hau,Latin
ibo,Latin
kin,Latin
orm,Latin
pcm,Latin
pt-MZ,Latin
swa,Latin
tir,Ethiopic
tso,Latin
twi,Latin
yor,Latin
15 changes: 15 additions & 0 deletions data/2023/2023-02-28/languages.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language_iso_code,language
amh,Amharic
arq,Algerian Arabic/Darja
ary,Moroccan Arabic/Darija
hau,Hausa
ibo,Igbo
kin,Kinyarwanda
orm,Oromo
pcm,Nigerian Pidgin
pt-MZ,Mozambican Portuguese
swa,Swahili
tir,Tigrinya
tso,Xitsonga
twi,Twi
yor,Yorùbá
Binary file added data/2023/2023-02-28/pic1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/2023/2023-02-28/pic2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions data/2023/2023-02-28/post_vars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"article_link": "https://arxiv.org/pdf/2302.08956.pdf",
"pic1_alt": "The AfriSenti logo. The continent Africa is incorporated into the A in AfriSenti, which is written in large, yellow-orange letters. Below that, Sentiment Analysis dataset for 14 African languages is written in smaller yellow letters.",
"pic2_alt": "A bar chart of positive, negative, and neutral sentiment in tweets from 14 African languages. The languages are shown as abbreviations on the x axis, and the number of tweets range from 0 to 8000 on the y axis. Each language has 3 bars: blue for positive, red for negative, green for neutral. Hausa has the most tweets in all three sentiment categories, with over 7000 in each. Nigerian Pidgin has disproportionally more negative tweets than positive or neutral, and Yoruba has more positive or neutral tweets than negative."
}
260 changes: 260 additions & 0 deletions data/2023/2023-02-28/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
### Please add alt text to your posts

Please add alt text (alternative text) to all of your posted graphics for `#TidyTuesday`.

Twitter provides [guidelines](https://help.twitter.com/en/using-twitter/picture-descriptions) for how to add alt text to your images.

The DataViz Society/Nightingale by way of Amy Cesal has an [article](https://medium.com/nightingale/writing-alt-text-for-data-visualization-2a218ef43f81) on writing _good_ alt text for plots/graphs.

> Here’s a simple formula for writing alt text for data visualization:
> ### Chart type
> It’s helpful for people with partial sight to know what chart type it is and gives context for understanding the rest of the visual.
> Example: Line graph
> ### Type of data
> What data is included in the chart? The x and y axis labels may help you figure this out.
> Example: number of bananas sold per day in the last year
> ### Reason for including the chart
> Think about why you’re including this visual. What does it show that’s meaningful. There should be a point to every visual and you should tell people what to look for.
> Example: the winter months have more banana sales
> ### Link to data or source
> Don’t include this in your alt text, but it should be included somewhere in the surrounding text. People should be able to click on a link to view the source data or dig further into the visual. This provides transparency about your source and lets people explore the data.
> Example: Data from the USDA
Penn State has an [article](https://accessibility.psu.edu/images/charts/) on writing alt text descriptions for charts and tables.

> Charts, graphs and maps use visuals to convey complex images to users. But since they are images, these media provide serious accessibility issues to colorblind users and users of screen readers. See the [examples on this page](https://accessibility.psu.edu/images/charts/) for details on how to make charts more accessible.
The `{rtweet}` package includes the [ability to post tweets](https://docs.ropensci.org/rtweet/reference/post_tweet.html) with alt text programatically.

Need a **reminder**? There are [extensions](https://chrome.google.com/webstore/detail/twitter-required-alt-text/fpjlpckbikddocimpfcgaldjghimjiik/related) that force you to remember to add Alt Text to Tweets with media.

# African Language Sentiment

The data this week comes from [AfriSenti: Sentiment Analysis dataset for 14 African languages](https://github.com/afrisenti-semeval/afrisent-semeval-2023) via [@shmuhammad2004](https://github.com/shmuhammad2004) (the corresponding author on the [associated paper](https://arxiv.org/pdf/2302.08956.pdf), and an active member of the [R4DS Online Learning Community Slack](https://r4ds.io/join)).

> This repository contains data for the SemEval 2023 Shared Task 12: Sentiment Analysis in African Languages (AfriSenti-SemEval).
The source repository also includes sentiment lexicons for several languages.


### Get the data here

```{r}
# Get the Data
# Read in with tidytuesdayR package
# Install from CRAN via: install.packages("tidytuesdayR")
# This loads the readme and all the datasets for the week of interest
# Either ISO-8601 date or year/week works!
tuesdata <- tidytuesdayR::tt_load('2023-02-28')
tuesdata <- tidytuesdayR::tt_load(2023, week = 9)
afrisenti <- tuesdata$afrisenti
languages <- tuesdata$languages
language_scripts <- tuesdata$language_scripts
language_countries <- tuesdata$language_countries
country_regions <- tuesdata$country_regions
# Or read in the data manually
afrisenti <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-28/afrisenti.csv')
languages <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-28/languages.csv')
language_scripts <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-28/language_scripts.csv')
language_countries <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-28/language_countries.csv')
country_regions <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-28/country_regions.csv')
```

### Data Dictionary

# `afrisenti.csv`

|variable |class |description |
|:-----------------|:---------|:-----------------|
|language_iso_code |character |The unique code used to identify the language |
|tweet |character |The text content of a tweet |
|label |character |A sentiment label of positive, negative, or neutral assigned by a native speaker of that language |
|intended_use |character |Whether the data came from the dev, test, or train set for that language |

# `languages.csv`

|variable |class |description |
|:-----------------|:---------|:-----------------|
|language_iso_code |character |The unique code used to identify the language |
|language |character |The name of the language |

# `language_scripts.csv`

|variable |class |description |
|:-----------------|:---------|:-----------------|
|language_iso_code |character |The unique code used to identify the language |
|script |character |The script used to write the language |

# `language_countries.csv`

|variable |class |description |
|:-----------------|:---------|:-----------------|
|language_iso_code |character |The unique code used to identify the language |
|country |character |A country in which the language is spoken |

# `country_regions.csv`

|variable |class |description |
|:--------|:---------|:-----------|
|country |character |A country in which the language is spoken |
|region |character |The region of Africa in which that country is categorized. Note that Mozambique is categorized as "East Africa", "Southern Africa", and "Southeastern Africa" |


### Cleaning Script

```r
library(tidyverse)

# Read in the data
language_abbrevs <- c(
"amh", "arq", "ary",
"hau", "ibo", "kin",
"oro", "pcm", "por",
"swa", "tir", "tso",
"twi", "yor"
)
# amh == ama, por == pt-MZ, oro == orm

splits <- c("dev", "test", "train")

afrisenti <- purrr::map(
language_abbrevs,
\(language_abbr) {
purrr::map(
splits,
\(split) {
readr::read_tsv(
paste0(
"https://raw.githubusercontent.com/afrisenti-semeval/afrisent-semeval-2023/main/data/",
language_abbr, "/", split, ".tsv"
)
) |>
dplyr::mutate(
language_abbreviation = language_abbr,
intended_use = split
)
}
) |>
purrr::list_rbind()
}
) |>
purrr::list_rbind()

glimpse(afrisenti)

# oro has an extra column.
afrisenti |>
dplyr::filter(!is.na(ID)) |>
dplyr::count(language_abbreviation)

# Drop the extra column, and arrange the columns. Also recode the
# language_abbreviation to formal ISO codes.
afrisenti <- afrisenti |>
dplyr::mutate(
language_iso_code = dplyr::recode(
language_abbreviation,
por = "pt-MZ",
oro = "orm"
)
) |>
dplyr::select(
language_iso_code,
tweet,
label,
intended_use
) |>
dplyr::arrange(language_iso_code, label, intended_use)

# Also include information about the languages. Start with Table 2 from
# https://arxiv.org/pdf/2302.08956.pdf but make it tidy.
languages_untidy <- tibble::tribble(
~language, ~language_iso_code, ~region, ~country, ~script,
"Amharic", "amh", "East Africa", "Ethiopia", "Ethiopic",
"Algerian Arabic/Darja", "arq", "North Africa", "Algeria", "Arabic",
"Hausa", "hau", "West Africa", "Nigeria", "Latin",
"Hausa", "hau", "West Africa", "Ghana", "Latin",
"Hausa", "hau", "West Africa", "Cameroon", "Latin",
"Igbo", "ibo", "West Africa", "Nigeria", "Latin",
"Kinyarwanda", "kin", "East Africa", "Rwanda", "Latin",
"Moroccan Arabic/Darija", "ary", "Northern Africa", "Morocco", "Arabic",
"Moroccan Arabic/Darija", "ary", "Northern Africa", "Morocco", "Latin",
"Mozambican Portuguese", "pt-MZ", "Southeastern Africa", "Mozambique", "Latin",
"Nigerian Pidgin", "pcm", "West Africa", "Nigeria", "Latin",
"Nigerian Pidgin", "pcm", "West Africa", "Ghana", "Latin",
"Nigerian Pidgin", "pcm", "West Africa", "Cameroon", "Latin",
"Oromo", "orm", "East Africa", "Ethiopia", "Latin",
"Swahili", "swa", "East Africa", "Tanzania", "Latin",
"Swahili", "swa", "East Africa", "Kenya", "Latin",
"Swahili", "swa", "East Africa", "Mozambique", "Latin",
"Tigrinya", "tir", "East Africa", "Ethiopia", "Ethiopic",
"Twi", "twi", "West Africa", "Ghana", "Latin",
"Xitsonga", "tso", "Southern Africa", "Mozambique", "Latin",
"Xitsonga", "tso", "Southern Africa", "South Africa", "Latin",
"Xitsonga", "tso", "Southern Africa", "Zimbabwe", "Latin",
"Xitsonga", "tso", "Southern Africa", "Eswatini", "Latin",
"Yorùbá", "yor", "West Africa", "Nigeria", "Latin"
)

languages <- languages_untidy |>
dplyr::distinct(language_iso_code, language) |>
dplyr::arrange(language_iso_code, language)

language_countries <- languages_untidy |>
dplyr::distinct(language_iso_code, country) |>
dplyr::arrange(language_iso_code, country)

language_scripts <- languages_untidy |>
dplyr::distinct(language_iso_code, script) |>
dplyr::arrange(language_iso_code, script)

country_regions <- languages_untidy |>
dplyr::distinct(country, region) |>
dplyr::arrange(country, region)

# Save the data.
write_csv(
afrisenti,
here::here(
"data", "2023", "2023-02-28",
"afrisenti.csv"
)
)

write_csv(
languages,
here::here(
"data", "2023", "2023-02-28",
"languages.csv"
)
)

write_csv(
language_scripts,
here::here(
"data", "2023", "2023-02-28",
"language_scripts.csv"
)
)

write_csv(
language_countries,
here::here(
"data", "2023", "2023-02-28",
"language_countries.csv"
)
)

write_csv(
country_regions,
here::here(
"data", "2023", "2023-02-28",
"country_regions.csv"
)
)
```
1 change: 1 addition & 0 deletions data/2023/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Archive of datasets and articles from the 2023 series of `#TidyTuesday` events.
| 6 | `2023-02-07` | [Big Tech Stock Prices](2023-02-07/readme.md) | [Big Tech Stock Prices on Kaggle](https://www.kaggle.com/datasets/evangower/big-tech-stock-prices) | [5 Charts on Big Tech Stocks’ Collapse](https://www.morningstar.com/articles/1129535/5-charts-on-big-tech-stocks-collapse) |
| 7 | `2023-02-14` | [Hollywood Age Gaps](2023-02-14/readme.md) | [Hollywood Age Gap Download Data](https://hollywoodagegap.com/movies.csv) | [Hollywood Age Gap](https://hollywoodagegap.com/) |
| 8 | `2023-02-21` | [Bob Ross Paintings](2023-02-21/readme.md) | [Bob Ross Paintings data](https://github.com/jwilber/Bob_Ross_Paintings/blob/master/data/bob_ross_paintings.csv) | [Bob Ross Colors data package](https://github.com/frankiethull/BobRossColors) |
| 9 | `2023-02-28` | [African Language Sentiment](2023-02-28/readme.md) | [AfriSenti: Sentiment Analysis dataset for 14 African languages](https://github.com/afrisenti-semeval/afrisent-semeval-2023) | [AfriSenti: A Twitter Sentiment Analysis Benchmark for African Languages](https://arxiv.org/pdf/2302.08956.pdf) |
7 changes: 0 additions & 7 deletions data/readme.md

This file was deleted.

5 changes: 5 additions & 0 deletions static/tt_data_type.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
Week,Date,year,data_files,data_type,delim
9,2023-02-28,2023,afrisenti.csv,csv,","
9,2023-02-28,2023,languages.csv,csv,","
9,2023-02-28,2023,language_scripts.csv,csv,","
9,2023-02-28,2023,language_countries.csv,csv,","
9,2023-02-28,2023,country_regions.csv,csv,","
8,2023-02-21,2023,bob_ross.csv,csv,","
7,2023-02-14,2023,age_gaps.csv,csv,","
6,2023-02-07,2023,big_tech_stock_prices.csv,csv,","
Expand Down

0 comments on commit d692fe5

Please sign in to comment.