# notes to myself to remember how to use Shiny
#all functions need to be in `context: setup`
#all data needs to be in `context: data`
#widgets: https://shiny.rstudio.com/articles/action-buttons.html
#`panel: sidebar` is like ui and shouldn't have much code at all.
#`context: server` is the equivalent of the old server function
## Bioconductor version '3.14' is out-of-date; the current release version '3.16'
## is available with R version '4.2'; see https://bioconductor.org/install
## Rows: 132 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): Artist, Album, Title, Lyrics
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Download UD model for tagging
ud_eng_dl <- udpipe::udpipe_download_model(language = "english-ewt")
## Downloading udpipe model from https://raw.githubusercontent.com/jwijffels/udpipe.models.ud.2.5/master/inst/udpipe-ud-2.5-191206/english-ewt-ud-2.5-191206.udpipe to /Users/sara/Desktop/TidyTuesdayCreations/english-ewt-ud-2.5-191206.udpipe
## - This model has been trained on version 2.5 of data from https://universaldependencies.org
## - The model is distributed under the CC-BY-SA-NC license: https://creativecommons.org/licenses/by-nc-sa/4.0
## - Visit https://github.com/jwijffels/udpipe.models.ud.2.5 for model license details.
## - For a list of all models and their licenses (most models you can download with this package have either a CC-BY-SA or a CC-BY-SA-NC license) read the documentation at ?udpipe_download_model. For building your own models: visit the documentation by typing vignette('udpipe-train', package = 'udpipe')
## Downloading finished, model stored at '/Users/sara/Desktop/TidyTuesdayCreations/english-ewt-ud-2.5-191206.udpipe'
# Load model
ud_eng <- udpipe::udpipe_load_model("english-ewt-ud-2.5-191206.udpipe")
# Analyze the horror movie titles and pipe to tibble format
ud_swift <- udpipe::udpipe_annotate(ud_eng, x = taylor_swift_lyrics$Lyrics) |>
as_tibble() |>
filter(!grepl("'|-", token)) |>
mutate(token = if_else(token == "I", token, str_to_lower(token))) |>
filter(token != "uh" & token != "eeh" & token != "eh" & token != "hm" & token != "ey")