Skip to content

Commit

Permalink
Moves README's output control to same script
Browse files Browse the repository at this point in the history
  • Loading branch information
edgararuiz committed Sep 21, 2024
1 parent 3f71507 commit 0e486d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 34 deletions.
24 changes: 2 additions & 22 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ library(dbplyr)
library(tictoc)
library(DBI)
source("utils/knitr-print.R")
mall::llm_use("ollama", "llama3.1", seed = 100, .cache = "_readme_cache")
```

Expand Down Expand Up @@ -105,28 +107,6 @@ reviews <- tribble(
)
```
```{r, include=FALSE}
# Customizing print for tibble because the 'review' is too long, and doesn't
# allow new columns to be read
library(tibble)
library(pillar)
reviews <- new_tibble(reviews, class = "tbl_long")
ctl_new_pillar.tbl_long <- function(controller, x, width, ...) {
out <- NextMethod()
if (attr(out$data, "width") > 50) {
attr(out$data, "width") <- 40
}
new_pillar(list(
title = out$title,
type = out$type,
data = out$data
))
}
```
### Sentiment
Primarily, `mall` provides verb-like functions that expect a `tbl` as
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,18 +355,18 @@ This is what the new table looks like:
``` r
reviews_llm
#> # A tibble: 100 × 3
#> review sentiment predicted
#> <chr> <fct> <chr>
#> 1 "i got this as both a book and an audio file. i had wait… 1 negative
#> 2 "this book places too much emphasis on spending money in… 1 negative
#> 3 "remember the hollywood blacklist? the hollywood ten? i'… 2 negative
#> 4 "while i appreciate what tipler was attempting to accomp… 1 negative
#> 5 "the others in the series were great, and i really looke… 1 negative
#> 6 "a few good things, but she's lost her edge and i find i… 1 negative
#> 7 "words cannot describe how ripped off and disappointed i… 1 negative
#> 8 "1. the persective of most writers is shaped by their ow… 1 negative
#> 9 "i have been a huge fan of michael crichton for about 25… 1 negative
#> 10 "i saw dr. polk on c-span a month or two ago. he was add… 2 positive
#> review sentiment predicted
#> <chr> <fct> <chr>
#> 1 "i got this as both a book and an audio… 1 negative
#> 2 "this book places too much emphasis on … 1 negative
#> 3 "remember the hollywood blacklist? the … 2 negative
#> 4 "while i appreciate what tipler was att… 1 negative
#> 5 "the others in the series were great, a… 1 negative
#> 6 "a few good things, but she's lost her … 1 negative
#> 7 "words cannot describe how ripped off a… 1 negative
#> 8 "1. the persective of most writers is s… 1 negative
#> 9 "i have been a huge fan of michael cric… 1 negative
#> 10 "i saw dr. polk on c-span a month or tw… 2 positive
#> # ℹ 90 more rows
```

Expand Down

0 comments on commit 0e486d8

Please sign in to comment.