Skip to content

IPBES-Data/AI_tries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.56">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

<meta name="author" content="Rainer M Krug">
<meta name="dcterms.date" content="2024-08-30">

<title>AI Assessment</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
  width: 0.8em;
  margin: 0 0.8em 0.2em -1em; /* quarto-specific, see quarto-dev/quarto-cli#4556 */ 
  vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
  }
pre.numberSource { margin-left: 3em;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>


<script src="README_files/libs/clipboard/clipboard.min.js"></script>
<script src="README_files/libs/quarto-html/quarto.js"></script>
<script src="README_files/libs/quarto-html/popper.min.js"></script>
<script src="README_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="README_files/libs/quarto-html/anchor.min.js"></script>
<link href="README_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="README_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="README_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="README_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="README_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">


</head>

<body>

<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
  <nav id="TOC" role="doc-toc" class="toc-active">
    <h2 id="toc-title">Table of contents</h2>
   
  <ul>
  <li><a href="#introduction" id="toc-introduction" class="nav-link active" data-scroll-target="#introduction">Introduction</a>
  <ul>
  <li><a href="#general-info-about-llama-training" id="toc-general-info-about-llama-training" class="nav-link" data-scroll-target="#general-info-about-llama-training">General info about Llama training</a></li>
  </ul></li>
  <li><a href="#setup" id="toc-setup" class="nav-link" data-scroll-target="#setup">Setup</a></li>
  <li><a href="#get-papers" id="toc-get-papers" class="nav-link" data-scroll-target="#get-papers">Get papers</a></li>
  <li><a href="#summarizing-abstracts" id="toc-summarizing-abstracts" class="nav-link" data-scroll-target="#summarizing-abstracts">Summarizing abstracts</a>
  <ul>
  <li><a href="#preparation" id="toc-preparation" class="nav-link" data-scroll-target="#preparation">Preparation</a></li>
  <li><a href="#serial" id="toc-serial" class="nav-link" data-scroll-target="#serial">Serial</a></li>
  <li><a href="#parallel" id="toc-parallel" class="nav-link" data-scroll-target="#parallel">Parallel</a></li>
  </ul></li>
  <li><a href="#sentiment-analysis" id="toc-sentiment-analysis" class="nav-link" data-scroll-target="#sentiment-analysis">Sentiment Analysis</a></li>
  <li><a href="#identification-of-country-of-study" id="toc-identification-of-country-of-study" class="nav-link" data-scroll-target="#identification-of-country-of-study">Identification of country of study</a></li>
  <li><a href="#comparson-multiple-analysis" id="toc-comparson-multiple-analysis" class="nav-link" data-scroll-target="#comparson-multiple-analysis">Comparson multiple Analysis</a>
  <ul>
  <li><a href="#sentiment-analysis-1" id="toc-sentiment-analysis-1" class="nav-link" data-scroll-target="#sentiment-analysis-1">Sentiment Analysis</a></li>
  <li><a href="#countries-analysis" id="toc-countries-analysis" class="nav-link" data-scroll-target="#countries-analysis">Countries Analysis</a></li>
  </ul></li>
  </ul>
</nav>
</div>
<main class="content" id="quarto-document-content">

<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">AI Assessment</h1>
<p class="subtitle lead">Assessment of LLM based methods for use in IPBES</p>
</div>


<div class="quarto-title-meta-author">
  <div class="quarto-title-meta-heading">Author</div>
  <div class="quarto-title-meta-heading">Affiliation</div>
  
    <div class="quarto-title-meta-contents">
    <p class="author">Rainer M Krug <a href="mailto:[email protected]" class="quarto-title-author-email"><i class="bi bi-envelope"></i></a> <a href="https://orcid.org/0000-0002-7490-0066" class="quarto-title-author-orcid"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo1N0NEMjA4MDI1MjA2ODExOTk0QzkzNTEzRjZEQTg1NyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozM0NDOEJGNEZGNTcxMUUxODdBOEVCODg2RjdCQ0QwOSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozM0NDOEJGM0ZGNTcxMUUxODdBOEVCODg2RjdCQ0QwOSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZDN0YxMTc0MDcyMDY4MTE5NUZFRDc5MUM2MUUwNEREIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjU3Q0QyMDgwMjUyMDY4MTE5OTRDOTM1MTNGNkRBODU3Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+84NovQAAAR1JREFUeNpiZEADy85ZJgCpeCB2QJM6AMQLo4yOL0AWZETSqACk1gOxAQN+cAGIA4EGPQBxmJA0nwdpjjQ8xqArmczw5tMHXAaALDgP1QMxAGqzAAPxQACqh4ER6uf5MBlkm0X4EGayMfMw/Pr7Bd2gRBZogMFBrv01hisv5jLsv9nLAPIOMnjy8RDDyYctyAbFM2EJbRQw+aAWw/LzVgx7b+cwCHKqMhjJFCBLOzAR6+lXX84xnHjYyqAo5IUizkRCwIENQQckGSDGY4TVgAPEaraQr2a4/24bSuoExcJCfAEJihXkWDj3ZAKy9EJGaEo8T0QSxkjSwORsCAuDQCD+QILmD1A9kECEZgxDaEZhICIzGcIyEyOl2RkgwAAhkmC+eAm0TAAAAABJRU5ErkJggg=="></a></p>
  </div>
  <div class="quarto-title-meta-contents">
        <p class="affiliation">
            <a href="www.uzh.ch">
            University of Zürich
            </a>
          </p>
      </div>
  </div>

<div class="quarto-title-meta">

      
    <div>
    <div class="quarto-title-meta-heading">Published</div>
    <div class="quarto-title-meta-contents">
      <p class="date">August 30, 2024</p>
    </div>
  </div>
  
    
    <div>
    <div class="quarto-title-meta-heading">Doi</div>
    <div class="quarto-title-meta-contents">
      <p class="doi">
        <a href="https://doi.org/xxxxxxxxxxxxxx">xxxxxxxxxxxxxx</a>
      </p>
    </div>
  </div>
  </div>
  
<div>
  <div class="abstract">
    <div class="block-title">Abstract</div>
    <p>This probably will be added later</p>
  </div>
</div>


</header>


<section id="introduction" class="level1">
<h1>Introduction</h1>
<p>Here I will try AI stuff, mainly using <a href="https://github.com/ollama/ollama">Ollama</a></p>
<p>Here are some links in no particular order:</p>
<ul>
<li><a href="https://towardsdatascience.com/running-llama-2-on-cpu-inference-for-document-q-a-3d636037a3d8">https://towardsdatascience.com/running-llama-2-on-cpu-inference-for-document-q-a-3d636037a3d8</a></li>
</ul>
<p>[Llama on Meta]https://llama.meta.com)</p>
<section id="general-info-about-llama-training" class="level2">
<h2 class="anchored" data-anchor-id="general-info-about-llama-training">General info about Llama training</h2>
<ul>
<li><a href="https://www.datacamp.com/tutorial/llama3-fine-tuning-locally">datacamp</a></li>
<li><a href="https://huggingface.co/blog/stackllama">hugginface</a></li>
</ul>
</section>
</section>
<section id="setup" class="level1">
<h1>Setup</h1>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co">#|</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="sc">!</span><span class="fu">require</span>(pak)) {</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a>  pak<span class="sc">::</span><span class="fu">pkg_install</span>(<span class="st">"pak"</span>)</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Loading required package: pak</code></pre>
</div>
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="sc">!</span><span class="fu">require</span>(ollamar)) {</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>  pak<span class="sc">::</span><span class="fu">pkg_install</span>(<span class="st">"ollamar"</span>)</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Loading required package: ollamar</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>
Attaching package: 'ollamar'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:stats':

    embed</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:methods':

    show</code></pre>
</div>
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ollamar)</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(dplyr)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>
Attaching package: 'dplyr'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:ollamar':

    pull</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following objects are masked from 'package:stats':

    filter, lag</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union</code></pre>
</div>
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tictoc)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>
Attaching package: 'tictoc'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:ollamar':

    push</code></pre>
</div>
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(pbapply)</span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(httr2)</span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a><span class="fu">try</span>(</span>
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a>  params <span class="ot">&lt;-</span> rmarkdown<span class="sc">::</span><span class="fu">yaml_front_matter</span>(<span class="st">"~/Documents_Local/git/IPBES_data_tsu/AI Tries/README.qmd"</span>)<span class="sc">$</span>params,</span>
<span id="cb16-5"><a href="#cb16-5" aria-hidden="true" tabindex="-1"></a>  <span class="at">silent =</span> <span class="cn">TRUE</span></span>
<span id="cb16-6"><a href="#cb16-6" aria-hidden="true" tabindex="-1"></a>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="get-papers" class="level1">
<h1>Get papers</h1>
<p>I am using a subsample of n random papers from the the IPBES TCA subsidies reform corpus, published after 2000.</p>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>fn <span class="ot">&lt;-</span> <span class="fu">file.path</span>(<span class="st">"."</span>, <span class="st">"data"</span>, <span class="st">"papers.rds"</span>)</span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(fn)) {</span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a>  papers <span class="ot">&lt;-</span> <span class="fu">readRDS</span>(fn)</span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span> {</span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a>  <span class="fu">set.seed</span>(params<span class="sc">$</span>rand_seed)</span>
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true" tabindex="-1"></a>  papers <span class="ot">&lt;-</span> params<span class="sc">$</span>corpus <span class="sc">|&gt;</span></span>
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true" tabindex="-1"></a>    IPBES.R<span class="sc">::</span><span class="fu">read_corpus</span>() <span class="sc">|&gt;</span></span>
<span id="cb17-9"><a href="#cb17-9" aria-hidden="true" tabindex="-1"></a>    dplyr<span class="sc">::</span><span class="fu">filter</span>(</span>
<span id="cb17-10"><a href="#cb17-10" aria-hidden="true" tabindex="-1"></a>      publication_year <span class="sc">&gt;</span> <span class="dv">2000</span>,</span>
<span id="cb17-11"><a href="#cb17-11" aria-hidden="true" tabindex="-1"></a>    ) <span class="sc">|&gt;</span></span>
<span id="cb17-12"><a href="#cb17-12" aria-hidden="true" tabindex="-1"></a>    dplyr<span class="sc">::</span><span class="fu">select</span>(</span>
<span id="cb17-13"><a href="#cb17-13" aria-hidden="true" tabindex="-1"></a>      id,</span>
<span id="cb17-14"><a href="#cb17-14" aria-hidden="true" tabindex="-1"></a>      doi,</span>
<span id="cb17-15"><a href="#cb17-15" aria-hidden="true" tabindex="-1"></a>      <span class="at">title =</span> display_name,</span>
<span id="cb17-16"><a href="#cb17-16" aria-hidden="true" tabindex="-1"></a>      <span class="at">abstract =</span> ab</span>
<span id="cb17-17"><a href="#cb17-17" aria-hidden="true" tabindex="-1"></a>    ) <span class="sc">|&gt;</span></span>
<span id="cb17-18"><a href="#cb17-18" aria-hidden="true" tabindex="-1"></a>    dplyr<span class="sc">::</span><span class="fu">slice_sample</span>(</span>
<span id="cb17-19"><a href="#cb17-19" aria-hidden="true" tabindex="-1"></a>      <span class="at">n =</span> params<span class="sc">$</span>n_samples</span>
<span id="cb17-20"><a href="#cb17-20" aria-hidden="true" tabindex="-1"></a>    ) <span class="sc">|&gt;</span></span>
<span id="cb17-21"><a href="#cb17-21" aria-hidden="true" tabindex="-1"></a>    dplyr<span class="sc">::</span><span class="fu">collect</span>()</span>
<span id="cb17-22"><a href="#cb17-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-23"><a href="#cb17-23" aria-hidden="true" tabindex="-1"></a>  <span class="fu">saveRDS</span>(papers, fn)</span>
<span id="cb17-24"><a href="#cb17-24" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="summarizing-abstracts" class="level1">
<h1>Summarizing abstracts</h1>
<p>Based on <a href="https://blog.stephenturner.us/p/use-r-to-prompt-a-local-llm-with">Use R to prompt a local LLM with ollamar</a></p>
<section id="preparation" class="level2">
<h2 class="anchored" data-anchor-id="preparation">Preparation</h2>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>summarized <span class="ot">&lt;-</span> papers <span class="sc">|&gt;</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(</span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a>    <span class="at">title =</span> title,</span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a>    abstract</span>
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb18-6"><a href="#cb18-6" aria-hidden="true" tabindex="-1"></a>  <span class="fu">mutate</span>(</span>
<span id="cb18-7"><a href="#cb18-7" aria-hidden="true" tabindex="-1"></a>    <span class="at">abstract =</span> <span class="fu">substr</span>(abstract, <span class="dv">1</span>, <span class="dv">3000</span>),</span>
<span id="cb18-8"><a href="#cb18-8" aria-hidden="true" tabindex="-1"></a>    <span class="fu">across</span>(</span>
<span id="cb18-9"><a href="#cb18-9" aria-hidden="true" tabindex="-1"></a>      <span class="fu">everything</span>(),</span>
<span id="cb18-10"><a href="#cb18-10" aria-hidden="true" tabindex="-1"></a>      trimws</span>
<span id="cb18-11"><a href="#cb18-11" aria-hidden="true" tabindex="-1"></a>    )</span>
<span id="cb18-12"><a href="#cb18-12" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb18-13"><a href="#cb18-13" aria-hidden="true" tabindex="-1"></a>  <span class="fu">mutate</span>(</span>
<span id="cb18-14"><a href="#cb18-14" aria-hidden="true" tabindex="-1"></a>    <span class="at">prompt =</span> <span class="fu">paste</span>(</span>
<span id="cb18-15"><a href="#cb18-15" aria-hidden="true" tabindex="-1"></a>      <span class="st">"</span><span class="sc">\n\n</span><span class="st">I'm going to give you a paper's title and abstract."</span>,</span>
<span id="cb18-16"><a href="#cb18-16" aria-hidden="true" tabindex="-1"></a>      <span class="st">"Can you summarize this paper in 2 sentences?"</span>,</span>
<span id="cb18-17"><a href="#cb18-17" aria-hidden="true" tabindex="-1"></a>      <span class="st">"</span><span class="sc">\n\n</span><span class="st">Title: "</span>, title, <span class="st">"</span><span class="sc">\n\n</span><span class="st">Abstract: "</span>, abstract,</span>
<span id="cb18-18"><a href="#cb18-18" aria-hidden="true" tabindex="-1"></a>      <span class="st">"</span><span class="sc">\n\n</span><span class="st">Only return the 2 sentence summary."</span>,</span>
<span id="cb18-19"><a href="#cb18-19" aria-hidden="true" tabindex="-1"></a>      <span class="st">"</span><span class="sc">\n\n</span><span class="st">Do not put anything in front or after the summary."</span></span>
<span id="cb18-20"><a href="#cb18-20" aria-hidden="true" tabindex="-1"></a>    )</span>
<span id="cb18-21"><a href="#cb18-21" aria-hidden="true" tabindex="-1"></a>  )</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="serial" class="level2">
<h2 class="anchored" data-anchor-id="serial">Serial</h2>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>fn <span class="ot">&lt;-</span> <span class="fu">file.path</span>(<span class="st">"."</span>, <span class="st">"data"</span>, <span class="st">"summarized_seriell.rds"</span>)</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(fn)) {</span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a>  summarized <span class="ot">&lt;-</span> <span class="fu">readRDS</span>(fn)</span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span> {</span>
<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a>  <span class="fu">tic</span>()</span>
<span id="cb19-7"><a href="#cb19-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-8"><a href="#cb19-8" aria-hidden="true" tabindex="-1"></a>  summarized<span class="sc">$</span>response <span class="ot">&lt;-</span> pbapply<span class="sc">::</span><span class="fu">pblapply</span>(</span>
<span id="cb19-9"><a href="#cb19-9" aria-hidden="true" tabindex="-1"></a>    summarized<span class="sc">$</span>prompt,</span>
<span id="cb19-10"><a href="#cb19-10" aria-hidden="true" tabindex="-1"></a>    <span class="cf">function</span>(x) {</span>
<span id="cb19-11"><a href="#cb19-11" aria-hidden="true" tabindex="-1"></a>      ollamar<span class="sc">::</span><span class="fu">generate</span>(</span>
<span id="cb19-12"><a href="#cb19-12" aria-hidden="true" tabindex="-1"></a>        <span class="at">model =</span> <span class="st">"llama3.1"</span>,</span>
<span id="cb19-13"><a href="#cb19-13" aria-hidden="true" tabindex="-1"></a>        <span class="at">prompt =</span> x,</span>
<span id="cb19-14"><a href="#cb19-14" aria-hidden="true" tabindex="-1"></a>        <span class="at">output =</span> <span class="st">"text"</span></span>
<span id="cb19-15"><a href="#cb19-15" aria-hidden="true" tabindex="-1"></a>      )</span>
<span id="cb19-16"><a href="#cb19-16" aria-hidden="true" tabindex="-1"></a>    }</span>
<span id="cb19-17"><a href="#cb19-17" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb19-18"><a href="#cb19-18" aria-hidden="true" tabindex="-1"></a>    <span class="fu">unlist</span>()</span>
<span id="cb19-19"><a href="#cb19-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-20"><a href="#cb19-20" aria-hidden="true" tabindex="-1"></a>  <span class="fu">toc</span>()</span>
<span id="cb19-21"><a href="#cb19-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-22"><a href="#cb19-22" aria-hidden="true" tabindex="-1"></a>  <span class="fu">saveRDS</span>(summarized, fn)</span>
<span id="cb19-23"><a href="#cb19-23" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb19-24"><a href="#cb19-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb19-25"><a href="#cb19-25" aria-hidden="true" tabindex="-1"></a>summarized <span class="sc">|&gt;</span></span>
<span id="cb19-26"><a href="#cb19-26" aria-hidden="true" tabindex="-1"></a>  <span class="fu">select</span>(</span>
<span id="cb19-27"><a href="#cb19-27" aria-hidden="true" tabindex="-1"></a>    title,</span>
<span id="cb19-28"><a href="#cb19-28" aria-hidden="true" tabindex="-1"></a>    response</span>
<span id="cb19-29"><a href="#cb19-29" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb19-30"><a href="#cb19-30" aria-hidden="true" tabindex="-1"></a>  <span class="fu">mutate</span>(</span>
<span id="cb19-31"><a href="#cb19-31" aria-hidden="true" tabindex="-1"></a>    <span class="at">response =</span> <span class="fu">gsub</span>(<span class="st">"</span><span class="sc">\n</span><span class="st">"</span>, <span class="st">" "</span>, response)</span>
<span id="cb19-32"><a href="#cb19-32" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb19-33"><a href="#cb19-33" aria-hidden="true" tabindex="-1"></a>  knitr<span class="sc">::</span><span class="fu">kable</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<table class="caption-top table table-sm table-striped small">
<colgroup>
<col style="width: 25%">
<col style="width: 74%">
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">title</th>
<th style="text-align: left;">response</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Productivity Trends from 1890 to 2012 in Advanced Countries</td>
<td style="text-align: left;">The paper examines productivity trends and changes in leadership among 13 advanced countries from 1890-2012, highlighting two major productivity waves driven by industrial revolutions and information technology advancements. The convergence process was erratic, influenced by wars, global financial crises, policy changes, and other shocks that led to significant productivity level leaps or declines.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Global Advisory Panel on the Future of Nursing (GAPFON) and Global Health</td>
<td style="text-align: left;">The Global Advisory Panel on the Future of Nursing (GAPFON) was established by Sigma Theta Tau International to create a voice and vision for nursing and midwifery’s role in advancing global health, with a focus on reform, advocacy, and innovation in leadership, policy, practice, education, and work environments. GAPFON aims to contribute to strengthening health systems and attaining global health goals through partnerships and collaborations among health professionals from various disciplines.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Democratising the media in the new democracies of Ghana and Nigeria: Challenges and prospects</td>
<td style="text-align: left;">This article examines the media reform initiatives in Ghana and Nigeria following their transitions to democracy, analyzing the extent to which Western donors impacted policy formulation and implementation. The author argues that these countries’ historical, political, and socio-cultural contexts have hindered the realization of their media reforms’ objectives.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Elite Institutionalism and Judicial Assertiveness in the Supreme Court of India</td>
<td style="text-align: left;">This paper examines judicial challenges to central government power in the Supreme Court of India, analyzing activism and assertiveness in fundamental rights decisions from 1977 to 2007, and finds that the court was selectively assertive in challenging the central government during this era. The author argues that existing public law theories fail to provide a complete account of patterns of judicial assertiveness, which can be better explained by focusing on the values of national political, professional, and intellectual elites that influence judges’ worldviews.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Effects of salmon on the diet and condition of stream-resident sculpins</td>
<td style="text-align: left;">This study investigated how spawning salmon affect the diets and condition of two species of sculpins (prickly and coastrange) across a wide gradient of salmon biomass in streams. The results showed that sculpin diets shifted towards salmon-derived nutrients with increasing salmon biomass, but this effect was mediated by season, habitat, individual body size, and species.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Significant reduction in red blood cell transfusions in a general hospital after successful implementation of a restrictive transfusion policy supported by prospective computerized order auditing</td>
<td style="text-align: left;">A hospital implemented a new, more restrictive red blood cell transfusion policy and used a computer system to support adherence to this policy. As a result, the total number of red blood cell units transfused per 1000 patient-days significantly decreased from 60.8 to 44.2.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">PENSION REFORM IN CHINA: CHALLENGES AND OPPORTUNITIES</td>
<td style="text-align: left;">China’s current pension system is plagued with regional imbalance, fiscal inefficiency, social inequality, and economic unsustainability due to a three-decade evolution driven by vague objectives, economic constraints, and interest-group politics. The country aims to establish a national pension system by 2020 that provides broad coverage, basic security, multiple options, and sustainability.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Educating into liberal peace: the International Crisis Group’s contribution to an emerging global governmentality</td>
<td style="text-align: left;">The International Crisis Group’s reports on Indonesia aim to diffuse a liberal governance agenda by de-politicizing violence and fostering liberal forms of governance through their policy advice and narrative technique. This article argues that the ICg is educating its audience into a liberal governmentality, contributing to sustaining liberalism as a global ‘regime of power’.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Debating Indonesia’s<i>Reformasi</i>: Bridging “Parallel Universes”</td>
<td style="text-align: left;">Scholars have long debated why Suharto fell and what Indonesia’s subsequent transition has entailed, with two competing interpretations emerging from liberal and oligarchy camps. This article seeks to bridge the gap between these “parallel universes” by reframing the oligarchy literature using the language of transition theories, highlighting important insights into changes in post-Suharto Indonesia that have been overlooked by liberals.</td>
</tr>
<tr class="even">
<td style="text-align: left;">The institutional design of river basin organizations – empirical findings from around the world</td>
<td style="text-align: left;">This paper provides a comprehensive overview of the institutional design of international river basin organizations (RBOs) using data from the RBO Institutional Design Database and the Transboundary Freshwater Dispute Database. The study aims to contribute to water resources governance research by providing institutional design data that can be used to compare different RBOs or assess their contributions to governing shared watercourses.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Evaluating the Possible Impact of Pension Reforms on Elderly Poverty in <scp>E</scp>urope</td>
<td style="text-align: left;">This paper evaluates the impact of pension reforms on elderly poverty in Europe by analyzing the changes in state pension provision and generosity. The results suggest that reforms have decreased pension wealth, making systems less progressive and raising concerns about adequacy for certain groups, particularly those who struggle to access labor markets.</td>
</tr>
<tr class="even">
<td style="text-align: left;">As You Sow So Shall You Reap: From Capabilities to Opportunities</td>
<td style="text-align: left;">The paper develops an “Index of Opportunities” for 96 non-high-income countries to measure their potential for economic growth through structural transformation, based on four dimensions: sophistication, diversification, standardness, and possibilities for exporting new products with comparative advantage. Countries like China, India, Poland, Thailand, Mexico, and Brazil rank high in the index, indicating they have accumulated significant capabilities for further economic transformation.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Carbon emissions, energy consumption and output: A threshold analysis on the causal dynamics in emerging African economies</td>
<td style="text-align: left;">This paper examines the causal dynamics among energy use, real GDP, and CO2 emissions in six emerging African economies using threshold cointegration and Granger causality techniques. The results confirm the presence of regime shift effects in the long-run inter-linkages among these variables, indicating that structural changes have both economic and environmental impacts.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Fighting for a future: an actor-oriented planning approach to landscape preservation in Galicia</td>
<td style="text-align: left;">This paper explores the challenges and opportunities for preserving cultural landscapes in Galicia, Spain, and develops an actor-oriented planning approach to address these issues. The study aims to contribute to the EU’s objectives of sustainable, inclusive, and smart growth by combining place-based development with landscape management in a geographically peripheral area.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Financialization in Turkey: The Case of Consumer Debt</td>
<td style="text-align: left;">This study uses a political economy approach to analyze the rise in consumer debt in Turkey over the last decade. The research finds that both supply-side factors, such as banks adapting to a changing economic environment, and demand-side factors, including rising poverty and reliance on credit for basic consumption, have contributed to this trend.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Organizational Reintegration and Trust Repair after an Integrity Violation: A Case Study</td>
<td style="text-align: left;">This paper presents a case study of a UK utilities firm’s efforts to restore trust with stakeholders after a fraud and data manipulation scandal, analyzing decisions and actions taken by the company. The analysis reveals seven themes on reintegration approaches and novel insights into organizational identity, leadership changes, cultural reforms, and procedural modifications in restoring stakeholder trust.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Adapting streams for climate change using riparian broadleaf trees and its consequences for stream salmonids</td>
<td style="text-align: left;">This study examined whether riparian broadleaf tree restoration can mitigate the effects of climate change on stream salmonids by analyzing fisheries data and stable isotope ratios from 18 temperate headwaters with different land use patterns. Contrary to expectation, the research found that catchment broadleaf cover had no significant effect on salmonid density or size, but did not harm them either, suggesting that this adaptation strategy may be neutral for stream salmonids.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Contract Research, Curricular Reform, and Situated Selves: Between Social Justice and Commercialized Knowledge</td>
<td style="text-align: left;">This paper examines how social scientists transition into contract research, particularly in education reform contexts marked by privatization, and how they adapt to balance personal connections with commercialized knowledge interests. The study’s findings suggest implications for social scientific knowledge work and the intersection of personal and macropolitical interests within this context.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">The potential of Russia to increase its wheat production through cropland expansion and intensification</td>
<td style="text-align: left;">Russia has significant unused land resources and yield gaps, suggesting that wheat production can be increased by up to 32 million tons through modest increases in crop productivity and recultivation of abandoned croplands. However, realizing this potential will require improved adaptation to climate volatility, institutional and political reforms, and substantial investment in the agricultural sector.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Climate change and farm-level adaptation decisions and strategies in drought-prone and groundwater-depleted areas of Bangladesh: an empirical investigation</td>
<td style="text-align: left;">Farmers in drought-prone and groundwater-depleted areas of Bangladesh prefer adaptation strategies such as using drought-tolerant rice, switching to non-rice crops, and conserving groundwater, among others. The success of these adaptations is hindered by limited access to climate information, inadequate irrigation facilities, and insufficient agricultural research and support services.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="parallel" class="level2">
<h2 class="anchored" data-anchor-id="parallel">Parallel</h2>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>fn <span class="ot">&lt;-</span> <span class="fu">file.path</span>(<span class="st">"."</span>, <span class="st">"data"</span>, <span class="st">"summarized_parallel.rds"</span>)</span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-3"><a href="#cb20-3" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(fn)) {</span>
<span id="cb20-4"><a href="#cb20-4" aria-hidden="true" tabindex="-1"></a>  summarized <span class="ot">&lt;-</span> <span class="fu">readRDS</span>(fn)</span>
<span id="cb20-5"><a href="#cb20-5" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span> {</span>
<span id="cb20-6"><a href="#cb20-6" aria-hidden="true" tabindex="-1"></a>  <span class="fu">tic</span>()</span>
<span id="cb20-7"><a href="#cb20-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-8"><a href="#cb20-8" aria-hidden="true" tabindex="-1"></a>  reqs <span class="ot">&lt;-</span> <span class="fu">lapply</span>(</span>
<span id="cb20-9"><a href="#cb20-9" aria-hidden="true" tabindex="-1"></a>    summarized<span class="sc">$</span>prompt,</span>
<span id="cb20-10"><a href="#cb20-10" aria-hidden="true" tabindex="-1"></a>    <span class="cf">function</span>(x) {</span>
<span id="cb20-11"><a href="#cb20-11" aria-hidden="true" tabindex="-1"></a>      ollamar<span class="sc">::</span><span class="fu">generate</span>(</span>
<span id="cb20-12"><a href="#cb20-12" aria-hidden="true" tabindex="-1"></a>        <span class="at">model =</span> <span class="st">"llama3.1"</span>,</span>
<span id="cb20-13"><a href="#cb20-13" aria-hidden="true" tabindex="-1"></a>        <span class="at">prompt =</span> x,</span>
<span id="cb20-14"><a href="#cb20-14" aria-hidden="true" tabindex="-1"></a>        <span class="at">output =</span> <span class="st">"req"</span></span>
<span id="cb20-15"><a href="#cb20-15" aria-hidden="true" tabindex="-1"></a>      )</span>
<span id="cb20-16"><a href="#cb20-16" aria-hidden="true" tabindex="-1"></a>    }</span>
<span id="cb20-17"><a href="#cb20-17" aria-hidden="true" tabindex="-1"></a>  )</span>
<span id="cb20-18"><a href="#cb20-18" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-19"><a href="#cb20-19" aria-hidden="true" tabindex="-1"></a>  resps <span class="ot">&lt;-</span> reqs <span class="sc">|&gt;</span></span>
<span id="cb20-20"><a href="#cb20-20" aria-hidden="true" tabindex="-1"></a>    httr2<span class="sc">::</span><span class="fu">req_perform_parallel</span>(</span>
<span id="cb20-21"><a href="#cb20-21" aria-hidden="true" tabindex="-1"></a>      <span class="at">progress =</span> <span class="cn">TRUE</span></span>
<span id="cb20-22"><a href="#cb20-22" aria-hidden="true" tabindex="-1"></a>    )</span>
<span id="cb20-23"><a href="#cb20-23" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-24"><a href="#cb20-24" aria-hidden="true" tabindex="-1"></a>  summarized<span class="sc">$</span>response <span class="ot">&lt;-</span> <span class="fu">sapply</span>(</span>
<span id="cb20-25"><a href="#cb20-25" aria-hidden="true" tabindex="-1"></a>    resps,</span>
<span id="cb20-26"><a href="#cb20-26" aria-hidden="true" tabindex="-1"></a>    ollamar<span class="sc">::</span>resp_process,</span>
<span id="cb20-27"><a href="#cb20-27" aria-hidden="true" tabindex="-1"></a>    <span class="st">"text"</span></span>
<span id="cb20-28"><a href="#cb20-28" aria-hidden="true" tabindex="-1"></a>  )</span>
<span id="cb20-29"><a href="#cb20-29" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-30"><a href="#cb20-30" aria-hidden="true" tabindex="-1"></a>  <span class="fu">toc</span>()</span>
<span id="cb20-31"><a href="#cb20-31" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-32"><a href="#cb20-32" aria-hidden="true" tabindex="-1"></a>  <span class="fu">saveRDS</span>(summarized, fn)</span>
<span id="cb20-33"><a href="#cb20-33" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb20-34"><a href="#cb20-34" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb20-35"><a href="#cb20-35" aria-hidden="true" tabindex="-1"></a>summarized <span class="sc">|&gt;</span></span>
<span id="cb20-36"><a href="#cb20-36" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(</span>
<span id="cb20-37"><a href="#cb20-37" aria-hidden="true" tabindex="-1"></a>    title,</span>
<span id="cb20-38"><a href="#cb20-38" aria-hidden="true" tabindex="-1"></a>    response</span>
<span id="cb20-39"><a href="#cb20-39" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb20-40"><a href="#cb20-40" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(</span>
<span id="cb20-41"><a href="#cb20-41" aria-hidden="true" tabindex="-1"></a>    <span class="at">response =</span> <span class="fu">gsub</span>(<span class="st">"</span><span class="sc">\n</span><span class="st">"</span>, <span class="st">" "</span>, response)</span>
<span id="cb20-42"><a href="#cb20-42" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb20-43"><a href="#cb20-43" aria-hidden="true" tabindex="-1"></a>  knitr<span class="sc">::</span><span class="fu">kable</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<table class="caption-top table table-sm table-striped small">
<colgroup>
<col style="width: 26%">
<col style="width: 73%">
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">title</th>
<th style="text-align: left;">response</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Productivity Trends from 1890 to 2012 in Advanced Countries</td>
<td style="text-align: left;">The paper examines productivity trends and convergence processes across 13 advanced countries from 1890-2012, highlighting two major waves of innovation driven by the second industrial revolution and the ICT revolution. The study finds that these waves were often staggered and influenced by various shocks, including wars, financial crises, and policy changes, leading to erratic convergence processes.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Global Advisory Panel on the Future of Nursing (GAPFON) and Global Health</td>
<td style="text-align: left;">The Global Advisory Panel on the Future of Nursing (GAPFON) was established to advance global health by promoting nursing and midwifery’s contributions to strengthening health systems and attaining global health goals. The panel aims to bring a clear voice and vision for the future of global health, particularly in addressing the United Nation’s Sustainable Development Goals (SDGs).</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Democratising the media in the new democracies of Ghana and Nigeria: Challenges and prospects</td>
<td style="text-align: left;">The institutionalization of democracy in Ghana and Nigeria led to media reform initiatives that aimed to create a free and independent press to support the democratic process. However, these efforts were impacted by Western donors and the countries’ historical, political, and socio-cultural antecedents, which limited their success.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Elite Institutionalism and Judicial Assertiveness in the Supreme Court of India</td>
<td style="text-align: left;">This article examines judicial challenges to central government power in India’s Supreme Court, analyzing activism and assertiveness in fundamental rights decisions from 1977 to 2007. It argues that a new approach called “elite institutionalism” better explains these patterns of judicial assertiveness, which reflected both the justices’ values and influences from elite meta-regimes on constitutional and social issues.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Effects of salmon on the diet and condition of stream-resident sculpins</td>
<td style="text-align: left;">This study examined the effects of spawning salmon on the diets and condition of two species of sculpins in British Columbia, Canada, finding that their diets shifted towards salmon-derived nutrients as salmon biomass increased. The timing and pathways by which spawning salmon influence freshwater consumers were influenced by season, habitat, individual body size, and species, with implications for ecosystem-based management.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Significant reduction in red blood cell transfusions in a general hospital after successful implementation of a restrictive transfusion policy supported by prospective computerized order auditing</td>
<td style="text-align: left;">A hospital implemented a restrictive red blood cell transfusion policy that recommended single-unit transfusions for non-bleeding patients with hemoglobin levels ≤7 g/dL, and used prospective computerized order auditing to enforce compliance. The policy resulted in a significant reduction in total red blood cell units transfused per 1000 patient-days and a decrease in the proportion of two-unit transfusions from 47% to 15%.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">PENSION REFORM IN CHINA: CHALLENGES AND OPPORTUNITIES</td>
<td style="text-align: left;">China’s current pension system is plagued by regional imbalance, fiscal inefficiency, social inequality, and economic unsustainability, prompting a national reform effort to establish a more comprehensive and sustainable system by 2020. The proposed reforms aim to provide universal coverage, basic security, multiple options, and long-term sustainability, but face significant challenges in implementation.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Educating into liberal peace: the International Crisis Group’s contribution to an emerging global governmentality</td>
<td style="text-align: left;">The International Crisis Group’s reports on Indonesia aim to educate their audience into a liberal governmentality characterized by practices and procedures that de-politicize violence, foster liberal forms of governance, and sustain liberalism as a global regime of power. Through its narrative technique of epideictic oratory, the ICg contributes to an emerging global governmentality that prioritizes institution building and security sector reform in addressing violent conflicts.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Debating Indonesia’s<i>Reformasi</i>: Bridging “Parallel Universes”</td>
<td style="text-align: left;">Scholars have long debated the reasons behind Indonesia’s transition from authoritarian rule under Suharto and the nature of the subsequent reforms. This article argues that by reframing one interpretation, known as the oligarchy literature, through the lens of transition theories, it is possible to clarify the differences in perspectives on the changes in post-Suharto Indonesia and stimulate more constructive engagement between scholars with differing views.</td>
</tr>
<tr class="even">
<td style="text-align: left;">The institutional design of river basin organizations – empirical findings from around the world</td>
<td style="text-align: left;">The paper provides a comprehensive overview of the institutional design of international river basin organizations (RBOs) using data from the RBO Institutional Design Database, summarizing empirical findings from around the world. The study contributes to water resources governance research and policy by comparing different RBOs and assessing their contributions to governing shared watercourses for more sustainable management.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Evaluating the Possible Impact of Pension Reforms on Elderly Poverty in <scp>E</scp>urope</td>
<td style="text-align: left;">This paper assesses the impact of pension reforms on elderly poverty in Europe using estimates of pension wealth for hypothetical cases, and finds that these reforms have decreased generosity significantly. The reforms have made systems less progressive, raising concerns about adequacy for certain groups, particularly those who may not be able to access labor markets or benefit from adequate crediting arrangements.</td>
</tr>
<tr class="even">
<td style="text-align: left;">As You Sow So Shall You Reap: From Capabilities to Opportunities</td>
<td style="text-align: left;">The paper develops an “Index of Opportunities” to measure a country’s capabilities for structural transformation through export diversification and upgrading, with countries like China, India, and Brazil scoring high and Guinea, Malawi, and Haiti scoring low. The Index highlights the need for policy support tailored to each country’s unique circumstances to facilitate further economic development.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Carbon emissions, energy consumption and output: A threshold analysis on the causal dynamics in emerging African economies</td>
<td style="text-align: left;">This paper examines the causal dynamics between energy consumption, output (GDP), and carbon emissions in six emerging African economies using threshold cointegration and Granger causality techniques. The results show that structural changes have both economic and environmental effects, indicating a need for integrated energy and environmental policies to achieve sustainable growth and development.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Fighting for a future: an actor-oriented planning approach to landscape preservation in Galicia</td>
<td style="text-align: left;">Economic optimization in agriculture can lead to reduced diversity and coherence in cultural landscapes, making landscape preservation a complex issue that requires changes in social-ecological organization. An actor-oriented planning approach is proposed for preserving landscapes in Galicia, Spain, taking into account contrasting viewpoints among local stakeholders and the need for collective management of natural resources.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Financialization in Turkey: The Case of Consumer Debt</td>
<td style="text-align: left;">This study analyzes the rise in consumer debt in Turkey over the last decade, arguing that it is historically unique and requires a consideration of both demand- and supply-side determinants within the context of transformations in the financial and non-financial sectors. The analysis suggests that on the supply side, banks adapted to Turkey’s deepening integration into the world economy by diversifying towards consumer lending, while on the demand side, consumer credit growth was linked to relative deprivation in popular incomes.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Organizational Reintegration and Trust Repair after an Integrity Violation: A Case Study</td>
<td style="text-align: left;">A UK utilities firm implemented various strategies to regain trust with stakeholders after a scandal involving fraud and data manipulation, including open investigations, apologies, and systemic reforms. The case study revealed seven themes for reintegration after an integrity violation and provided novel insights on organizational identity, cultural reforms, and stakeholder salience in the reintegration process.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Adapting streams for climate change using riparian broadleaf trees and its consequences for stream salmonids</td>
<td style="text-align: left;">This study investigates the effects of riparian broadleaf tree cover on stream-dwelling salmonids, finding no systematic impact on density or size despite previous expectations that such an increase would benefit these fish. The research suggests that other factors, such as catchment land use and in-stream food sources, have a more significant influence on brown trout diet and overall biomass than riparian broadleaf tree cover.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Contract Research, Curricular Reform, and Situated Selves: Between Social Justice and Commercialized Knowledge</td>
<td style="text-align: left;">This paper explores how social scientists transition into contract research, navigating between their personal desire to contribute to social change and commercialized knowledge that serves macropolitical interests. Through a critical ethnographic perspective, the study examines the implications of this shift for social scientific knowledge work and its potential consequences for public education.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">The potential of Russia to increase its wheat production through cropland expansion and intensification</td>
<td style="text-align: left;">Russia’s wheat production has the potential to increase by 9-32 million tons due to modest increases in crop productivity and recultivation of abandoned croplands, particularly within the fertile black soil belt. However, frequent droughts and adverse market conditions may hinder this potential, requiring improved climate adaptation and institutional reforms.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Climate change and farm-level adaptation decisions and strategies in drought-prone and groundwater-depleted areas of Bangladesh: an empirical investigation</td>
<td style="text-align: left;">This study investigates farm-level adaptation strategies to climate change among rice farmers in drought-prone and groundwater-depleted areas of Bangladesh, identifying preferred adaptations such as science-driven crop varieties and environmental resource management. The results highlight key factors influencing farmer decision-making, including access to climate information and irrigation facilities, while also highlighting major barriers to adaptation, including inadequate information access and limited infrastructure.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
</section>
<section id="sentiment-analysis" class="level1">
<h1>Sentiment Analysis</h1>
<p>Inspired by the sentiment analysis at https://github.com/hauselin/ollama-r/</p>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a>fn <span class="ot">&lt;-</span> <span class="fu">file.path</span>(<span class="st">"."</span>, <span class="st">"data"</span>, <span class="st">"sentiments.rds"</span>)</span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(fn)) {</span>
<span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a>  sentiments <span class="ot">&lt;-</span> <span class="fu">readRDS</span>(fn)</span>
<span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span> {</span>
<span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a>  reqs <span class="ot">&lt;-</span> <span class="fu">lapply</span>(</span>
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true" tabindex="-1"></a>    <span class="dv">1</span><span class="sc">:</span><span class="fu">nrow</span>(papers),</span>
<span id="cb21-8"><a href="#cb21-8" aria-hidden="true" tabindex="-1"></a>    <span class="cf">function</span>(i) {</span>
<span id="cb21-9"><a href="#cb21-9" aria-hidden="true" tabindex="-1"></a>      <span class="fu">paste0</span>(</span>
<span id="cb21-10"><a href="#cb21-10" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">I give you the title and abstract of a scientific paper."</span>,</span>
<span id="cb21-11"><a href="#cb21-11" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Your only task/role is to evaluate the sentiment of these towards subsidies."</span>,</span>
<span id="cb21-12"><a href="#cb21-12" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Your response should be a valid json with the following info."</span>,</span>
<span id="cb21-13"><a href="#cb21-13" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   id: the id of the paper as provided."</span>,</span>
<span id="cb21-14"><a href="#cb21-14" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   sentiment: the identified response. It should be one of the following:'positive' or 'negative', or, if you find no information to evaluate the sentiment of the text, 'unknown'."</span>,</span>
<span id="cb21-15"><a href="#cb21-15" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   strength: if sentiment is 'positive' or 'negative', a score from -10 to 10 for the sentiment (-10 most negative, 10 most positive), , otherwise -99 if sentiment is unknown,"</span>,</span>
<span id="cb21-16"><a href="#cb21-16" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   score: if sentiment is 'positive' or 'negative', a value how confident you are in your assessment, ranging from 0 = 'not confident at all' to 10 = 'very confident', otherwise -99 if sentiment is unknown,"</span>,</span>
<span id="cb21-17"><a href="#cb21-17" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   explanation: an explanation why you think the sentiment is that way. If the sentiment is 'unknown',"</span>,</span>
<span id="cb21-18"><a href="#cb21-18" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   summary: a 1 sentence summary of the title and abstract, irrespective of the sentiment."</span>,</span>
<span id="cb21-19"><a href="#cb21-19" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Do not put anything in front or behind the valid json."</span>,</span>
<span id="cb21-20"><a href="#cb21-20" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Do not halucinate."</span>,</span>
<span id="cb21-21"><a href="#cb21-21" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Base your response only on the information I give you."</span>,</span>
<span id="cb21-22"><a href="#cb21-22" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Do not summarise the information."</span>,</span>
<span id="cb21-23"><a href="#cb21-23" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">The id is:"</span>, papers<span class="sc">$</span>id[[i]],</span>
<span id="cb21-24"><a href="#cb21-24" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">The titel is:"</span>, papers<span class="sc">$</span>title[[i]],</span>
<span id="cb21-25"><a href="#cb21-25" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">The abstract is:"</span>, <span class="fu">substr</span>(papers<span class="sc">$</span>abstract[[i]], <span class="dv">1</span>, <span class="dv">3000</span>)</span>
<span id="cb21-26"><a href="#cb21-26" aria-hidden="true" tabindex="-1"></a>      ) <span class="sc">|&gt;</span></span>
<span id="cb21-27"><a href="#cb21-27" aria-hidden="true" tabindex="-1"></a>        ollamar<span class="sc">::</span><span class="fu">generate</span>(</span>
<span id="cb21-28"><a href="#cb21-28" aria-hidden="true" tabindex="-1"></a>          <span class="at">model =</span> <span class="st">"llama3.1"</span>,</span>
<span id="cb21-29"><a href="#cb21-29" aria-hidden="true" tabindex="-1"></a>          <span class="at">output =</span> <span class="st">"req"</span></span>
<span id="cb21-30"><a href="#cb21-30" aria-hidden="true" tabindex="-1"></a>        )</span>
<span id="cb21-31"><a href="#cb21-31" aria-hidden="true" tabindex="-1"></a>    }</span>
<span id="cb21-32"><a href="#cb21-32" aria-hidden="true" tabindex="-1"></a>  )</span>
<span id="cb21-33"><a href="#cb21-33" aria-hidden="true" tabindex="-1"></a>  sentiments <span class="ot">&lt;-</span> <span class="fu">lapply</span>(</span>
<span id="cb21-34"><a href="#cb21-34" aria-hidden="true" tabindex="-1"></a>    <span class="dv">1</span><span class="sc">:</span>params<span class="sc">$</span>n_analysis,</span>
<span id="cb21-35"><a href="#cb21-35" aria-hidden="true" tabindex="-1"></a>    <span class="cf">function</span>(i) {</span>
<span id="cb21-36"><a href="#cb21-36" aria-hidden="true" tabindex="-1"></a>      <span class="fu">message</span>(i, <span class="st">" of "</span>, params<span class="sc">$</span>n_analysis, <span class="st">"..."</span>)</span>
<span id="cb21-37"><a href="#cb21-37" aria-hidden="true" tabindex="-1"></a>      <span class="fu">tic</span>()</span>
<span id="cb21-38"><a href="#cb21-38" aria-hidden="true" tabindex="-1"></a>      result <span class="ot">&lt;-</span> httr2<span class="sc">::</span><span class="fu">req_perform_parallel</span>(</span>
<span id="cb21-39"><a href="#cb21-39" aria-hidden="true" tabindex="-1"></a>        reqs,</span>
<span id="cb21-40"><a href="#cb21-40" aria-hidden="true" tabindex="-1"></a>        <span class="at">progress =</span> <span class="cn">TRUE</span></span>
<span id="cb21-41"><a href="#cb21-41" aria-hidden="true" tabindex="-1"></a>      ) <span class="sc">|&gt;</span></span>
<span id="cb21-42"><a href="#cb21-42" aria-hidden="true" tabindex="-1"></a>        <span class="fu">sapply</span>(</span>
<span id="cb21-43"><a href="#cb21-43" aria-hidden="true" tabindex="-1"></a>          <span class="cf">function</span>(resp) {</span>
<span id="cb21-44"><a href="#cb21-44" aria-hidden="true" tabindex="-1"></a>            ollamar<span class="sc">::</span><span class="fu">resp_process</span>(</span>
<span id="cb21-45"><a href="#cb21-45" aria-hidden="true" tabindex="-1"></a>              resp,</span>
<span id="cb21-46"><a href="#cb21-46" aria-hidden="true" tabindex="-1"></a>              <span class="at">output =</span> <span class="st">"text"</span></span>
<span id="cb21-47"><a href="#cb21-47" aria-hidden="true" tabindex="-1"></a>            )</span>
<span id="cb21-48"><a href="#cb21-48" aria-hidden="true" tabindex="-1"></a>          }</span>
<span id="cb21-49"><a href="#cb21-49" aria-hidden="true" tabindex="-1"></a>        )</span>
<span id="cb21-50"><a href="#cb21-50" aria-hidden="true" tabindex="-1"></a>      <span class="fu">toc</span>()</span>
<span id="cb21-51"><a href="#cb21-51" aria-hidden="true" tabindex="-1"></a>      <span class="fu">return</span>(result)</span>
<span id="cb21-52"><a href="#cb21-52" aria-hidden="true" tabindex="-1"></a>    }</span>
<span id="cb21-53"><a href="#cb21-53" aria-hidden="true" tabindex="-1"></a>  )</span>
<span id="cb21-54"><a href="#cb21-54" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-55"><a href="#cb21-55" aria-hidden="true" tabindex="-1"></a>  <span class="fu">saveRDS</span>(sentiments, fn)</span>
<span id="cb21-56"><a href="#cb21-56" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb21-57"><a href="#cb21-57" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-58"><a href="#cb21-58" aria-hidden="true" tabindex="-1"></a><span class="do">###</span></span>
<span id="cb21-59"><a href="#cb21-59" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-60"><a href="#cb21-60" aria-hidden="true" tabindex="-1"></a>fn <span class="ot">&lt;-</span> <span class="fu">file.path</span>(<span class="st">"."</span>, <span class="st">"data"</span>, <span class="st">"sentiments_df.rds"</span>)</span>
<span id="cb21-61"><a href="#cb21-61" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-62"><a href="#cb21-62" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(fn)) {</span>
<span id="cb21-63"><a href="#cb21-63" aria-hidden="true" tabindex="-1"></a>  sentiments_df <span class="ot">&lt;-</span> <span class="fu">readRDS</span>(fn)</span>
<span id="cb21-64"><a href="#cb21-64" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span> {</span>
<span id="cb21-65"><a href="#cb21-65" aria-hidden="true" tabindex="-1"></a>  sentiments_df <span class="ot">&lt;-</span> <span class="fu">lapply</span>(</span>
<span id="cb21-66"><a href="#cb21-66" aria-hidden="true" tabindex="-1"></a>    sentiments,</span>
<span id="cb21-67"><a href="#cb21-67" aria-hidden="true" tabindex="-1"></a>    <span class="cf">function</span>(sentiments) {</span>
<span id="cb21-68"><a href="#cb21-68" aria-hidden="true" tabindex="-1"></a>      sentiments_df <span class="ot">&lt;-</span> <span class="fu">lapply</span>(</span>
<span id="cb21-69"><a href="#cb21-69" aria-hidden="true" tabindex="-1"></a>        sentiments,</span>
<span id="cb21-70"><a href="#cb21-70" aria-hidden="true" tabindex="-1"></a>        <span class="cf">function</span>(resp) {</span>
<span id="cb21-71"><a href="#cb21-71" aria-hidden="true" tabindex="-1"></a>          res <span class="ot">&lt;-</span> jsonlite<span class="sc">::</span><span class="fu">fromJSON</span>(</span>
<span id="cb21-72"><a href="#cb21-72" aria-hidden="true" tabindex="-1"></a>            resp</span>
<span id="cb21-73"><a href="#cb21-73" aria-hidden="true" tabindex="-1"></a>          )</span>
<span id="cb21-74"><a href="#cb21-74" aria-hidden="true" tabindex="-1"></a>          res<span class="sc">$</span>strength <span class="ot">&lt;-</span> <span class="fu">as.integer</span>(res<span class="sc">$</span>strength)</span>
<span id="cb21-75"><a href="#cb21-75" aria-hidden="true" tabindex="-1"></a>          res<span class="sc">$</span>score <span class="ot">&lt;-</span> <span class="fu">as.integer</span>(res<span class="sc">$</span>score)</span>
<span id="cb21-76"><a href="#cb21-76" aria-hidden="true" tabindex="-1"></a>          <span class="fu">return</span>(res)</span>
<span id="cb21-77"><a href="#cb21-77" aria-hidden="true" tabindex="-1"></a>        }</span>
<span id="cb21-78"><a href="#cb21-78" aria-hidden="true" tabindex="-1"></a>      ) <span class="sc">|&gt;</span></span>
<span id="cb21-79"><a href="#cb21-79" aria-hidden="true" tabindex="-1"></a>        dplyr<span class="sc">::</span><span class="fu">bind_rows</span>()</span>
<span id="cb21-80"><a href="#cb21-80" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-81"><a href="#cb21-81" aria-hidden="true" tabindex="-1"></a>      sentiments_df[sentiments_df <span class="sc">==</span> <span class="sc">-</span><span class="dv">99</span>] <span class="ot">&lt;-</span> <span class="fu">as.integer</span>(<span class="cn">NA</span>)</span>
<span id="cb21-82"><a href="#cb21-82" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-83"><a href="#cb21-83" aria-hidden="true" tabindex="-1"></a>      <span class="fu">return</span>(sentiments_df)</span>
<span id="cb21-84"><a href="#cb21-84" aria-hidden="true" tabindex="-1"></a>    }</span>
<span id="cb21-85"><a href="#cb21-85" aria-hidden="true" tabindex="-1"></a>  )</span>
<span id="cb21-86"><a href="#cb21-86" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-87"><a href="#cb21-87" aria-hidden="true" tabindex="-1"></a>  <span class="fu">saveRDS</span>(sentiments_df, fn)</span>
<span id="cb21-88"><a href="#cb21-88" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb21-89"><a href="#cb21-89" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-90"><a href="#cb21-90" aria-hidden="true" tabindex="-1"></a>sentiments_df[[<span class="dv">1</span>]] <span class="sc">|&gt;</span></span>
<span id="cb21-91"><a href="#cb21-91" aria-hidden="true" tabindex="-1"></a>  knitr<span class="sc">::</span><span class="fu">kable</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output-display">
<table class="caption-top table table-sm table-striped small">
<colgroup>
<col style="width: 4%">
<col style="width: 1%">
<col style="width: 1%">
<col style="width: 0%">
<col style="width: 57%">
<col style="width: 34%">
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">id</th>
<th style="text-align: left;">sentiment</th>
<th style="text-align: right;">strength</th>
<th style="text-align: right;">score</th>
<th style="text-align: left;">explanation</th>
<th style="text-align: left;">summary</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1501295874</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">-8</td>
<td style="text-align: right;">7</td>
<td style="text-align: left;">The abstract mentions a ‘downward trend break’ for the US in the mid-2000s, and questions the future contribution of the ICT revolution to productivity enhancement.</td>
<td style="text-align: left;">The paper studies productivity trends and convergence processes in advanced countries over 1890-2012, highlighting two productivity waves and analyzing their impact on different economies.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1515750961</td>
<td style="text-align: left;">unknown</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">NA</td>
<td style="text-align: left;">The abstract discusses the importance of nursing and midwifery in global health, but does not mention subsidies.</td>
<td style="text-align: left;">The Global Advisory Panel on the Future of Nursing (GAPFON) was created to advance global health goals through exchange of ideas and experiences across different regions.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1520730601</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">-8</td>
<td style="text-align: right;">7</td>
<td style="text-align: left;">The author argues that the media reforms in Ghana and Nigeria did not fully realise their objectives due to historical, political and socio-cultural factors.</td>
<td style="text-align: left;">A study on the challenges and prospects of democratising the media in Ghana and Nigeria after years of military regimes.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1584099318</td>
<td style="text-align: left;">unknown</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">NA</td>
<td style="text-align: left;">No information is provided in the title and abstract regarding subsidies.</td>
<td style="text-align: left;">The article examines judicial challenges to central government power in the Supreme Court of India from 1977 to 2007, analyzing activism and assertiveness in fundamental rights decisions.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1876345230</td>
<td style="text-align: left;">unknown</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">NA</td>
<td style="text-align: left;">No information about subsidies is present in the title and abstract, which discuss the effects of salmon on the diet and condition of sculpins.</td>
<td style="text-align: left;">The study investigates how salmon affects the diets and condition of two freshwater fish species across a wide range of salmon biomass in streams.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1923989173</td>
<td style="text-align: left;">positive</td>
<td style="text-align: right;">9</td>
<td style="text-align: right;">8</td>
<td style="text-align: left;">The title and abstract discuss the successful implementation of a restrictive transfusion policy supported by prospective computerized order auditing, which led to a significant reduction in red blood cell transfusions. The text highlights the positive outcomes of this change, including decreased total number of RBC units transfused, proportion of 2-unit TXNs, and pretransfusion Hb triggers.</td>
<td style="text-align: left;">A restrictive transfusion policy supported by prospective computerized order auditing resulted in a significant reduction in red blood cell transfusions at a general hospital.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1932544288</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">-7</td>
<td style="text-align: right;">6</td>
<td style="text-align: left;">The abstract describes a ‘segmented pension system’ as a result of ‘three-decade evolution guided by vague long-term objectives, constrained by economic and political circumstances’, which implies criticism or dissatisfaction.</td>
<td style="text-align: left;">China aims to establish a national pension system with wide coverage and sustainability by 2020 due to rapid population ageing and economic transformation.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1970758996</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">-8</td>
<td style="text-align: right;">7</td>
<td style="text-align: left;">The International Crisis Group’s recommendations and publications aim to promote liberal governance and depoliticization of violence, which may be seen as promoting a particular ideology and undermining local forms of government.</td>
<td style="text-align: left;">An academic article examining the International Crisis Group’s reports on Indonesia and their contribution to an emerging global governmentality.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1974805814</td>
<td style="text-align: left;">unknown</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">NA</td>
<td style="text-align: left;">The text does not mention subsidies at all.</td>
<td style="text-align: left;">Scholars disagree over why Suharto fell and the subsequent political transition in Indonesia.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1977307647</td>
<td style="text-align: left;">unknown</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">NA</td>
<td style="text-align: left;">No mention or discussion of subsidies in the title or abstract.</td>
<td style="text-align: left;">The paper presents a comprehensive overview of the institutional design of all international river basin organizations.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1985327519</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">-8</td>
<td style="text-align: right;">7</td>
<td style="text-align: left;">The title and abstract discuss pension reforms leading to decreased generosity, less progressive systems, and concerns about adequacy for certain groups.</td>
<td style="text-align: left;">Pension reforms have decreased generosity and led to less progressive systems in Europe.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1988416265</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">-6</td>
<td style="text-align: right;">8</td>
<td style="text-align: left;">The text discusses countries that ‘score poorly’ in the Index of Opportunities, implying a lack of capabilities and opportunities for economic transformation. This suggests a negative sentiment towards these countries’ potential, which could be related to subsidies if they are seen as essential for their development.</td>
<td style="text-align: left;">The paper develops an ‘Index of Opportunities’ to measure countries’ capabilities for structural transformation, with some countries ranking poorly.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1990059036</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">5</td>
<td style="text-align: right;">8</td>
<td style="text-align: left;">The paper suggests that structural reforms in emerging African economies have direct and indirect effects on growth, demand for energy, and CO2 emissions. The findings imply that integration of energy and environmental policies into development plans is imperative towards attaining sustainable growth and development, which may be perceived as a negative view towards subsidies or lack thereof.</td>
<td style="text-align: left;">The paper examines the causal dynamics among energy use, real GDP, and CO2 emissions in emerging African economies using threshold cointegration and Granger causality techniques.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W2001095260</td>
<td style="text-align: left;">positive</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">9</td>
<td style="text-align: left;">The text highlights the need for changes in the social-ecological organisation of places to preserve landscapes, which is supported by CAP reforms that turn from individual production subsidies to collective management. This suggests a positive view towards subsidies.</td>
<td style="text-align: left;">Economic optimisation reduces diversity and coherence of cultural landscapes, necessitating changes in social-ecological organisation and new management regimes supported by CAP reforms.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W2005224581</td>
<td style="text-align: left;">unknown</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">NA</td>
<td style="text-align: left;">There is no information in the title and abstract that allows to evaluate the sentiment towards subsidies. The text discusses consumer debt in Turkey, but does not mention subsidies at all.</td>
<td style="text-align: left;">The study offers a political economy approach to an analysis of the rise in consumer debt by drawing on the case of Turkey.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W2011122896</td>
<td style="text-align: left;">unknown</td>
<td style="text-align: right;">NA</td>
<td style="text-align: right;">NA</td>
<td style="text-align: left;">No information is provided about subsidies in the title and abstract.</td>
<td style="text-align: left;">A case study of reintegration and trust repair at a UK utilities firm after its fraud and data manipulation scandal.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W2011577131</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">-6</td>
<td style="text-align: right;">8</td>
<td style="text-align: left;">The authors found that catchment broadleaf cover had no systematic effect on salmonid density or individual size, which is contrary to expectations and implies a negative impact on the subsidies.</td>
<td style="text-align: left;">A study examining the effects of riparian broadleaf forest management on stream-dwelling salmonids in temperate regions.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W2015727898</td>
<td style="text-align: left;">negative</td>
<td style="text-align: right;">-5</td>
<td style="text-align: right;">6</td>
<td style="text-align: left;">The sentiment is negative because the abstract mentions ‘privatization of all aspects of public education’, which implies a negative view towards the trend. The mention of commercialized knowledge also suggests a negative connotation.</td>
<td style="text-align: left;">This paper explores how social scientists transition into evaluation work in a privatized education environment, highlighting adaptations to maintain personal connection and discussing implications for social scientific knowledge work.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W2023128043</td>
<td style="text-align: left;">positive</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">9</td>
<td style="text-align: left;">The sentiment is positive because the abstract mentions ‘substantially increased’ wheat production potential, and proposes specific actions (modest increases in crop productivity and recultivation of abandoned croplands) that could lead to a significant increase in production. The use of words like ‘demonstrate’, ‘could’, and ‘necessary’ also suggest a positive tone.</td>
<td style="text-align: left;">The study assesses the potential for Russia to increase its wheat production through land expansion, intensification, and adaptation to climate change.</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W2027818165</td>
<td style="text-align: left;">positive</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">9</td>
<td style="text-align: left;">The paper discusses the importance of farm-level adaptation strategies and identifies agricultural subsidies as a significant factor in farmers’ decisions to adapt. The conclusion emphasizes the need for strengthening support services, including information accessibility and community-focussed farming education.</td>
<td style="text-align: left;">This study investigates farm-level adaptation to climate change in Bangladesh using data from 1800 farm-households.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="identification-of-country-of-study" class="level1">
<h1>Identification of country of study</h1>
<p>Here I will try to extract the country of the study fropm the abstract and title</p>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb22"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a>fn <span class="ot">&lt;-</span> <span class="fu">file.path</span>(<span class="st">"."</span>, <span class="st">"data"</span>, <span class="st">"countries.rds"</span>)</span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-3"><a href="#cb22-3" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(fn)) {</span>
<span id="cb22-4"><a href="#cb22-4" aria-hidden="true" tabindex="-1"></a>  countries <span class="ot">&lt;-</span> <span class="fu">readRDS</span>(fn)</span>
<span id="cb22-5"><a href="#cb22-5" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span> {</span>
<span id="cb22-6"><a href="#cb22-6" aria-hidden="true" tabindex="-1"></a>  reqs <span class="ot">&lt;-</span> <span class="fu">lapply</span>(</span>
<span id="cb22-7"><a href="#cb22-7" aria-hidden="true" tabindex="-1"></a>    <span class="dv">1</span><span class="sc">:</span><span class="fu">nrow</span>(papers),</span>
<span id="cb22-8"><a href="#cb22-8" aria-hidden="true" tabindex="-1"></a>    <span class="cf">function</span>(i) {</span>
<span id="cb22-9"><a href="#cb22-9" aria-hidden="true" tabindex="-1"></a>      <span class="fu">paste0</span>(</span>
<span id="cb22-10"><a href="#cb22-10" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">I give you the title and abstract of a scientific paper."</span>,</span>
<span id="cb22-11"><a href="#cb22-11" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Your only task/role is to determine the country or countries of the study."</span>,</span>
<span id="cb22-12"><a href="#cb22-12" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Strip all linebreak and </span><span class="sc">\\</span><span class="st">n from your response."</span>,</span>
<span id="cb22-13"><a href="#cb22-13" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Your response should contain the following fields:"</span>,</span>
<span id="cb22-14"><a href="#cb22-14" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   id: the id of the paper as specified. Do not remove anything from the ID I give you."</span>,</span>
<span id="cb22-15"><a href="#cb22-15" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   countries (a string): the countries as identified separated by commas, 'global' if the study has a global or worldwide scope, or, if you find no countries in the text, unknown."</span>,</span>
<span id="cb22-16"><a href="#cb22-16" aria-hidden="true" tabindex="-1"></a>        <span class="co"># "\n\n   c_3: three letters iso codes for the countries, if you find no countries or do not haver the iso three letter abbreviation the text, unknown.",</span></span>
<span id="cb22-17"><a href="#cb22-17" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">   score (an integer value): a value how confident you are in your assessment, ranging from 0 = 'not confident at all' to 10 = 'very confident', otherwise -99. Always return a numeric value."</span>,</span>
<span id="cb22-18"><a href="#cb22-18" aria-hidden="true" tabindex="-1"></a>        <span class="co"># "\n\n   explanation: an explanation why you identified the countries, for all countries identified,",</span></span>
<span id="cb22-19"><a href="#cb22-19" aria-hidden="true" tabindex="-1"></a>        <span class="co"># "\n\n   summary: a 1 sentence summary of the title and abstract, irrespective of the countries.",</span></span>
<span id="cb22-20"><a href="#cb22-20" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">the fields should be put into a valid json string."</span>,</span>
<span id="cb22-21"><a href="#cb22-21" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Do only return the fieelds asked for."</span>,</span>
<span id="cb22-22"><a href="#cb22-22" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Do not put anything in front or behind the answer."</span>,</span>
<span id="cb22-23"><a href="#cb22-23" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Do not halucinate."</span>,</span>
<span id="cb22-24"><a href="#cb22-24" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">Base your response only on the information I give you."</span>,</span>
<span id="cb22-25"><a href="#cb22-25" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">The ID is:"</span>, papers<span class="sc">$</span>id[[i]],</span>
<span id="cb22-26"><a href="#cb22-26" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">The titel is:"</span>, papers<span class="sc">$</span>title[[i]],</span>
<span id="cb22-27"><a href="#cb22-27" aria-hidden="true" tabindex="-1"></a>        <span class="st">"</span><span class="sc">\n\n</span><span class="st">The abstract is:"</span>, <span class="fu">substr</span>(papers<span class="sc">$</span>abstract[[i]], <span class="dv">1</span>, <span class="dv">3000</span>)</span>
<span id="cb22-28"><a href="#cb22-28" aria-hidden="true" tabindex="-1"></a>      ) <span class="sc">|&gt;</span></span>
<span id="cb22-29"><a href="#cb22-29" aria-hidden="true" tabindex="-1"></a>        ollamar<span class="sc">::</span><span class="fu">generate</span>(</span>
<span id="cb22-30"><a href="#cb22-30" aria-hidden="true" tabindex="-1"></a>          <span class="at">model =</span> <span class="st">"llama3.1"</span>,</span>
<span id="cb22-31"><a href="#cb22-31" aria-hidden="true" tabindex="-1"></a>          <span class="at">output =</span> <span class="st">"req"</span></span>
<span id="cb22-32"><a href="#cb22-32" aria-hidden="true" tabindex="-1"></a>        )</span>
<span id="cb22-33"><a href="#cb22-33" aria-hidden="true" tabindex="-1"></a>    }</span>
<span id="cb22-34"><a href="#cb22-34" aria-hidden="true" tabindex="-1"></a>  )</span>
<span id="cb22-35"><a href="#cb22-35" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-36"><a href="#cb22-36" aria-hidden="true" tabindex="-1"></a>  countries <span class="ot">&lt;-</span> <span class="fu">lapply</span>(</span>
<span id="cb22-37"><a href="#cb22-37" aria-hidden="true" tabindex="-1"></a>    <span class="dv">1</span><span class="sc">:</span>params<span class="sc">$</span>n_analysis,</span>
<span id="cb22-38"><a href="#cb22-38" aria-hidden="true" tabindex="-1"></a>    <span class="cf">function</span>(i) {</span>
<span id="cb22-39"><a href="#cb22-39" aria-hidden="true" tabindex="-1"></a>      <span class="fu">message</span>(i, <span class="st">" of "</span>, params<span class="sc">$</span>n_analysis, <span class="st">"..."</span>)</span>
<span id="cb22-40"><a href="#cb22-40" aria-hidden="true" tabindex="-1"></a>      <span class="fu">tic</span>()</span>
<span id="cb22-41"><a href="#cb22-41" aria-hidden="true" tabindex="-1"></a>      result <span class="ot">&lt;-</span> httr2<span class="sc">::</span><span class="fu">req_perform_parallel</span>(</span>
<span id="cb22-42"><a href="#cb22-42" aria-hidden="true" tabindex="-1"></a>        reqs,</span>
<span id="cb22-43"><a href="#cb22-43" aria-hidden="true" tabindex="-1"></a>        <span class="at">progress =</span> <span class="cn">TRUE</span></span>
<span id="cb22-44"><a href="#cb22-44" aria-hidden="true" tabindex="-1"></a>      ) <span class="sc">|&gt;</span></span>
<span id="cb22-45"><a href="#cb22-45" aria-hidden="true" tabindex="-1"></a>        <span class="fu">sapply</span>(</span>
<span id="cb22-46"><a href="#cb22-46" aria-hidden="true" tabindex="-1"></a>          <span class="cf">function</span>(resp) {</span>
<span id="cb22-47"><a href="#cb22-47" aria-hidden="true" tabindex="-1"></a>            ollamar<span class="sc">::</span><span class="fu">resp_process</span>(</span>
<span id="cb22-48"><a href="#cb22-48" aria-hidden="true" tabindex="-1"></a>              resp,</span>
<span id="cb22-49"><a href="#cb22-49" aria-hidden="true" tabindex="-1"></a>              <span class="at">output =</span> <span class="st">"text"</span></span>
<span id="cb22-50"><a href="#cb22-50" aria-hidden="true" tabindex="-1"></a>            )</span>
<span id="cb22-51"><a href="#cb22-51" aria-hidden="true" tabindex="-1"></a>          }</span>
<span id="cb22-52"><a href="#cb22-52" aria-hidden="true" tabindex="-1"></a>        )</span>
<span id="cb22-53"><a href="#cb22-53" aria-hidden="true" tabindex="-1"></a>      <span class="fu">toc</span>()</span>
<span id="cb22-54"><a href="#cb22-54" aria-hidden="true" tabindex="-1"></a>      <span class="fu">return</span>(result)</span>
<span id="cb22-55"><a href="#cb22-55" aria-hidden="true" tabindex="-1"></a>    }</span>
<span id="cb22-56"><a href="#cb22-56" aria-hidden="true" tabindex="-1"></a>  )</span>
<span id="cb22-57"><a href="#cb22-57" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-58"><a href="#cb22-58" aria-hidden="true" tabindex="-1"></a>  <span class="fu">saveRDS</span>(countries, fn)</span>
<span id="cb22-59"><a href="#cb22-59" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb22-60"><a href="#cb22-60" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-61"><a href="#cb22-61" aria-hidden="true" tabindex="-1"></a><span class="do">###</span></span>
<span id="cb22-62"><a href="#cb22-62" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-63"><a href="#cb22-63" aria-hidden="true" tabindex="-1"></a><span class="co"># fn &lt;- file.path(".", "data", "countries_df.rds")</span></span>
<span id="cb22-64"><a href="#cb22-64" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-65"><a href="#cb22-65" aria-hidden="true" tabindex="-1"></a><span class="co"># if (file.exists(fn)) {</span></span>
<span id="cb22-66"><a href="#cb22-66" aria-hidden="true" tabindex="-1"></a><span class="co">#   countries_df &lt;- readRDS(fn)</span></span>
<span id="cb22-67"><a href="#cb22-67" aria-hidden="true" tabindex="-1"></a><span class="co"># } else {</span></span>
<span id="cb22-68"><a href="#cb22-68" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-69"><a href="#cb22-69" aria-hidden="true" tabindex="-1"></a><span class="co">#   countries_df &lt;- lapply(</span></span>
<span id="cb22-70"><a href="#cb22-70" aria-hidden="true" tabindex="-1"></a><span class="co">#     countries,</span></span>
<span id="cb22-71"><a href="#cb22-71" aria-hidden="true" tabindex="-1"></a><span class="co">#     function(countries) {</span></span>
<span id="cb22-72"><a href="#cb22-72" aria-hidden="true" tabindex="-1"></a><span class="co">#       countries_df &lt;- lapply(</span></span>
<span id="cb22-73"><a href="#cb22-73" aria-hidden="true" tabindex="-1"></a><span class="co">#         countries,</span></span>
<span id="cb22-74"><a href="#cb22-74" aria-hidden="true" tabindex="-1"></a><span class="co">#         function(resp) {</span></span>
<span id="cb22-75"><a href="#cb22-75" aria-hidden="true" tabindex="-1"></a><span class="co">#           res &lt;- jsonlite::fromJSON(</span></span>
<span id="cb22-76"><a href="#cb22-76" aria-hidden="true" tabindex="-1"></a><span class="co">#             resp</span></span>
<span id="cb22-77"><a href="#cb22-77" aria-hidden="true" tabindex="-1"></a><span class="co">#           )</span></span>
<span id="cb22-78"><a href="#cb22-78" aria-hidden="true" tabindex="-1"></a><span class="co">#           res$score &lt;- as.integer(res$score)</span></span>
<span id="cb22-79"><a href="#cb22-79" aria-hidden="true" tabindex="-1"></a><span class="co">#           return(res)</span></span>
<span id="cb22-80"><a href="#cb22-80" aria-hidden="true" tabindex="-1"></a><span class="co">#         }</span></span>
<span id="cb22-81"><a href="#cb22-81" aria-hidden="true" tabindex="-1"></a><span class="co">#       ) |&gt;</span></span>
<span id="cb22-82"><a href="#cb22-82" aria-hidden="true" tabindex="-1"></a><span class="co">#         dplyr::bind_rows()</span></span>
<span id="cb22-83"><a href="#cb22-83" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-84"><a href="#cb22-84" aria-hidden="true" tabindex="-1"></a><span class="co">#       countries_df[countries_df == -99] &lt;- as.integer(NA)</span></span>
<span id="cb22-85"><a href="#cb22-85" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-86"><a href="#cb22-86" aria-hidden="true" tabindex="-1"></a><span class="co">#       return(countries_df)</span></span>
<span id="cb22-87"><a href="#cb22-87" aria-hidden="true" tabindex="-1"></a><span class="co">#     }</span></span>
<span id="cb22-88"><a href="#cb22-88" aria-hidden="true" tabindex="-1"></a><span class="co">#   )</span></span>
<span id="cb22-89"><a href="#cb22-89" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-90"><a href="#cb22-90" aria-hidden="true" tabindex="-1"></a><span class="co">#   saveRDS(countries_df, fn)</span></span>
<span id="cb22-91"><a href="#cb22-91" aria-hidden="true" tabindex="-1"></a><span class="co"># }</span></span>
<span id="cb22-92"><a href="#cb22-92" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb22-93"><a href="#cb22-93" aria-hidden="true" tabindex="-1"></a><span class="co"># countries_df[[1]] |&gt;</span></span>
<span id="cb22-94"><a href="#cb22-94" aria-hidden="true" tabindex="-1"></a><span class="co">#   knitr::kable()</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="comparson-multiple-analysis" class="level1">
<h1>Comparson multiple Analysis</h1>
<p>As an LLM gives different answers in each time it is asked, I will compare here the results from two different analysis runs.</p>
<section id="sentiment-analysis-1" class="level2">
<h2 class="anchored" data-anchor-id="sentiment-analysis-1">Sentiment Analysis</h2>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>sens <span class="ot">&lt;-</span> <span class="fu">readRDS</span>(<span class="fu">file.path</span>(<span class="st">"."</span>, <span class="st">"data"</span>, <span class="st">"sentiments_df.rds"</span>)) <span class="sc">|&gt;</span></span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">bind_rows</span>()</span>
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb23-4"><a href="#cb23-4" aria-hidden="true" tabindex="-1"></a>sens <span class="sc">|&gt;</span></span>
<span id="cb23-5"><a href="#cb23-5" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">summarise</span>(</span>
<span id="cb23-6"><a href="#cb23-6" aria-hidden="true" tabindex="-1"></a>    <span class="at">negative =</span> <span class="fu">sum</span>(<span class="fu">as.integer</span>(sentiment <span class="sc">==</span> <span class="st">"negative"</span>)),</span>
<span id="cb23-7"><a href="#cb23-7" aria-hidden="true" tabindex="-1"></a>    <span class="at">positive =</span> <span class="fu">sum</span>(<span class="fu">as.integer</span>(sentiment <span class="sc">==</span> <span class="st">"positive"</span>)),</span>
<span id="cb23-8"><a href="#cb23-8" aria-hidden="true" tabindex="-1"></a>    <span class="at">unknown =</span> <span class="fu">sum</span>(<span class="fu">as.integer</span>(sentiment <span class="sc">==</span> <span class="st">"unknown"</span>)),</span>
<span id="cb23-9"><a href="#cb23-9" aria-hidden="true" tabindex="-1"></a>    <span class="at">strength_min =</span> <span class="fu">min</span>(strength, <span class="at">na.rm =</span> <span class="cn">TRUE</span>),</span>
<span id="cb23-10"><a href="#cb23-10" aria-hidden="true" tabindex="-1"></a>    <span class="at">strength_mean =</span> <span class="fu">round</span>(<span class="fu">mean</span>(strength, <span class="at">na.rm =</span> <span class="cn">TRUE</span>), <span class="at">digits =</span> <span class="dv">1</span>),</span>
<span id="cb23-11"><a href="#cb23-11" aria-hidden="true" tabindex="-1"></a>    <span class="at">strength_max =</span> <span class="fu">max</span>(strength, <span class="at">na.rm =</span> <span class="cn">TRUE</span>),</span>
<span id="cb23-12"><a href="#cb23-12" aria-hidden="true" tabindex="-1"></a>    <span class="at">score_min =</span> <span class="fu">min</span>(score, <span class="at">na.rm =</span> <span class="cn">TRUE</span>),</span>
<span id="cb23-13"><a href="#cb23-13" aria-hidden="true" tabindex="-1"></a>    <span class="at">score_mean =</span> <span class="fu">round</span>(<span class="fu">mean</span>(score, <span class="at">na.rm =</span> <span class="cn">TRUE</span>, <span class="at">digits =</span> <span class="dv">1</span>)),</span>
<span id="cb23-14"><a href="#cb23-14" aria-hidden="true" tabindex="-1"></a>    <span class="at">score_max =</span> <span class="fu">max</span>(score, <span class="at">na.rm =</span> <span class="cn">TRUE</span>),</span>
<span id="cb23-15"><a href="#cb23-15" aria-hidden="true" tabindex="-1"></a>    <span class="at">.by =</span> id</span>
<span id="cb23-16"><a href="#cb23-16" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb23-17"><a href="#cb23-17" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">mutate</span>(</span>
<span id="cb23-18"><a href="#cb23-18" aria-hidden="true" tabindex="-1"></a>    <span class="at">neg_pos_unkn =</span> <span class="fu">paste</span>(negative, positive, unknown, <span class="at">sep =</span> <span class="st">" -- "</span>),</span>
<span id="cb23-19"><a href="#cb23-19" aria-hidden="true" tabindex="-1"></a>    <span class="at">strength =</span> <span class="fu">paste</span>(strength_min, strength_mean, strength_max, <span class="at">sep =</span> <span class="st">" -- "</span>),</span>
<span id="cb23-20"><a href="#cb23-20" aria-hidden="true" tabindex="-1"></a>    <span class="at">score =</span> <span class="fu">paste</span>(score_min, score_mean, score_max, <span class="at">sep =</span> <span class="st">" -- "</span>)</span>
<span id="cb23-21"><a href="#cb23-21" aria-hidden="true" tabindex="-1"></a>    <span class="co"># strength_min,</span></span>
<span id="cb23-22"><a href="#cb23-22" aria-hidden="true" tabindex="-1"></a>    <span class="co"># strength_mean,</span></span>
<span id="cb23-23"><a href="#cb23-23" aria-hidden="true" tabindex="-1"></a>    <span class="co"># strength_max,</span></span>
<span id="cb23-24"><a href="#cb23-24" aria-hidden="true" tabindex="-1"></a>    <span class="co"># score_min,</span></span>
<span id="cb23-25"><a href="#cb23-25" aria-hidden="true" tabindex="-1"></a>    <span class="co"># score_mean,</span></span>
<span id="cb23-26"><a href="#cb23-26" aria-hidden="true" tabindex="-1"></a>    <span class="co"># score_max</span></span>
<span id="cb23-27"><a href="#cb23-27" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb23-28"><a href="#cb23-28" aria-hidden="true" tabindex="-1"></a>  dplyr<span class="sc">::</span><span class="fu">select</span>(</span>
<span id="cb23-29"><a href="#cb23-29" aria-hidden="true" tabindex="-1"></a>    id,</span>
<span id="cb23-30"><a href="#cb23-30" aria-hidden="true" tabindex="-1"></a>    neg_pos_unkn,</span>
<span id="cb23-31"><a href="#cb23-31" aria-hidden="true" tabindex="-1"></a>    strength,</span>
<span id="cb23-32"><a href="#cb23-32" aria-hidden="true" tabindex="-1"></a>    score</span>
<span id="cb23-33"><a href="#cb23-33" aria-hidden="true" tabindex="-1"></a>  ) <span class="sc">|&gt;</span></span>
<span id="cb23-34"><a href="#cb23-34" aria-hidden="true" tabindex="-1"></a>  knitr<span class="sc">::</span><span class="fu">kable</span>(</span>
<span id="cb23-35"><a href="#cb23-35" aria-hidden="true" tabindex="-1"></a>    <span class="at">align =</span> <span class="fu">c</span>(<span class="st">"l"</span>, <span class="st">"c"</span>, <span class="st">"c"</span>, <span class="st">"c"</span>)</span>
<span id="cb23-36"><a href="#cb23-36" aria-hidden="true" tabindex="-1"></a>  )</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: There were 20 warnings in `dplyr::summarise()`.
The first warning was:
ℹ In argument: `strength_min = min(strength, na.rm = TRUE)`.
ℹ In group 2: `id = "https://openalex.org/W1515750961"`.
Caused by warning in `min()`:
! no non-missing arguments to min; returning Inf
ℹ Run `dplyr::last_dplyr_warnings()` to see the 19 remaining warnings.</code></pre>
</div>
<div class="cell-output-display">
<table class="caption-top table table-sm table-striped small">
<colgroup>
<col style="width: 37%">
<col style="width: 16%">
<col style="width: 22%">
<col style="width: 22%">
</colgroup>
<thead>
<tr class="header">
<th style="text-align: left;">id</th>
<th style="text-align: center;">neg_pos_unkn</th>
<th style="text-align: center;">strength</th>
<th style="text-align: center;">score</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1501295874</td>
<td style="text-align: center;">2 – 0 – 1</td>
<td style="text-align: center;">-8 – -6.5 – -5</td>
<td style="text-align: center;">7 – 7 – 7</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1515750961</td>
<td style="text-align: center;">0 – 0 – 3</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1520730601</td>
<td style="text-align: center;">1 – 0 – 2</td>
<td style="text-align: center;">-8 – -8 – -8</td>
<td style="text-align: center;">7 – 7 – 7</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1584099318</td>
<td style="text-align: center;">0 – 0 – 3</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1876345230</td>
<td style="text-align: center;">1 – 1 – 1</td>
<td style="text-align: center;">-8 – 0 – 8</td>
<td style="text-align: center;">6 – 8 – 9</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1923989173</td>
<td style="text-align: center;">0 – 3 – 0</td>
<td style="text-align: center;">8 – 8.3 – 9</td>
<td style="text-align: center;">8 – 9 – 9</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1932544288</td>
<td style="text-align: center;">2 – 0 – 1</td>
<td style="text-align: center;">-7 – -6 – -5</td>
<td style="text-align: center;">6 – 6 – 6</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1970758996</td>
<td style="text-align: center;">2 – 0 – 1</td>
<td style="text-align: center;">-8 – -8 – -8</td>
<td style="text-align: center;">7 – 8 – 8</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1974805814</td>
<td style="text-align: center;">0 – 0 – 3</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1977307647</td>
<td style="text-align: center;">0 – 0 – 3</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1985327519</td>
<td style="text-align: center;">3 – 0 – 0</td>
<td style="text-align: center;">-8 – -7 – -5</td>
<td style="text-align: center;">7 – 7 – 8</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W1988416265</td>
<td style="text-align: center;">3 – 0 – 0</td>
<td style="text-align: center;">-8 – -7.3 – -6</td>
<td style="text-align: center;">6 – 8 – 9</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W1990059036</td>
<td style="text-align: center;">3 – 0 – 0</td>
<td style="text-align: center;">-7 – -2.3 – 5</td>
<td style="text-align: center;">8 – 8 – 8</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W2001095260</td>
<td style="text-align: center;">1 – 2 – 0</td>
<td style="text-align: center;">-8 – 2.7 – 8</td>
<td style="text-align: center;">9 – 9 – 9</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W2005224581</td>
<td style="text-align: center;">1 – 0 – 2</td>
<td style="text-align: center;">-8 – -8 – -8</td>
<td style="text-align: center;">6 – 6 – 6</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W2011122896</td>
<td style="text-align: center;">0 – 0 – 3</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
<td style="text-align: center;">Inf – NaN – -Inf</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W2011577131</td>
<td style="text-align: center;">3 – 0 – 0</td>
<td style="text-align: center;">-8 – -6.7 – -6</td>
<td style="text-align: center;">8 – 8 – 9</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W2015727898</td>
<td style="text-align: center;">2 – 0 – 1</td>
<td style="text-align: center;">-5 – -5 – -5</td>
<td style="text-align: center;">6 – 6 – 6</td>
</tr>
<tr class="odd">
<td style="text-align: left;">https://openalex.org/W2023128043</td>
<td style="text-align: center;">0 – 3 – 0</td>
<td style="text-align: center;">8 – 8 – 8</td>
<td style="text-align: center;">9 – 9 – 9</td>
</tr>
<tr class="even">
<td style="text-align: left;">https://openalex.org/W2027818165</td>
<td style="text-align: center;">0 – 3 – 0</td>
<td style="text-align: center;">8 – 8 – 8</td>
<td style="text-align: center;">9 – 9 – 9</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="countries-analysis" class="level2">
<h2 class="anchored" data-anchor-id="countries-analysis">Countries Analysis</h2>
<p>This is not possible at the moment as llama returns sometimes invalid json for the answer.</p>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="sourceCode cell-code" id="cb25"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>sens <span class="ot">&lt;-</span> <span class="fu">readRDS</span>(<span class="fu">file.path</span>(<span class="st">"."</span>, <span class="st">"data"</span>, <span class="st">"countries_study_df.rds"</span>))</span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a><span class="co"># sentiment &lt;- tibble::tibble(</span></span>
<span id="cb25-4"><a href="#cb25-4" aria-hidden="true" tabindex="-1"></a><span class="co">#   equal = sens[[1]]$sentiment == sens[[2]]$sentiment,</span></span>
<span id="cb25-5"><a href="#cb25-5" aria-hidden="true" tabindex="-1"></a><span class="co">#   sens_1 = sens[[1]]$sentiment,</span></span>
<span id="cb25-6"><a href="#cb25-6" aria-hidden="true" tabindex="-1"></a><span class="co">#   score_1 = sens[[1]]$score,</span></span>
<span id="cb25-7"><a href="#cb25-7" aria-hidden="true" tabindex="-1"></a><span class="co">#   sens_2 = sens[[2]]$sentiment,</span></span>
<span id="cb25-8"><a href="#cb25-8" aria-hidden="true" tabindex="-1"></a><span class="co">#   score_2 = sens[[2]]$score</span></span>
<span id="cb25-9"><a href="#cb25-9" aria-hidden="true" tabindex="-1"></a><span class="co"># )</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-reuse"><h2 class="anchored quarto-appendix-heading">Reuse</h2><div class="quarto-appendix-contents"><div><a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></div></div></section><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@report{m_krug2024,
  author = {M Krug, Rainer},
  title = {AI {Assessment}},
  date = {2024-08-30},
  doi = {xxxxxxxxxxxxxx},
  langid = {en},
  abstract = {This probably will be added later}
}
</code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-m_krug2024" class="csl-entry quarto-appendix-citeas" role="listitem">
M Krug, Rainer. 2024. <span>“AI Assessment.”</span> <a href="https://doi.org/xxxxxxxxxxxxxx">https://doi.org/xxxxxxxxxxxxxx</a>.
</div></div></section></div></main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
  const toggleBodyColorMode = (bsSheetEl) => {
    const mode = bsSheetEl.getAttribute("data-mode");
    const bodyEl = window.document.querySelector("body");
    if (mode === "dark") {
      bodyEl.classList.add("quarto-dark");
      bodyEl.classList.remove("quarto-light");
    } else {
      bodyEl.classList.add("quarto-light");
      bodyEl.classList.remove("quarto-dark");
    }
  }
  const toggleBodyColorPrimary = () => {
    const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
    if (bsSheetEl) {
      toggleBodyColorMode(bsSheetEl);
    }
  }
  toggleBodyColorPrimary();  
  const icon = "";
  const anchorJS = new window.AnchorJS();
  anchorJS.options = {
    placement: 'right',
    icon: icon
  };
  anchorJS.add('.anchored');
  const isCodeAnnotation = (el) => {
    for (const clz of el.classList) {
      if (clz.startsWith('code-annotation-')) {                     
        return true;
      }
    }
    return false;
  }
  const onCopySuccess = function(e) {
    // button target
    const button = e.trigger;
    // don't keep focus
    button.blur();
    // flash "checked"
    button.classList.add('code-copy-button-checked');
    var currentTitle = button.getAttribute("title");
    button.setAttribute("title", "Copied!");
    let tooltip;
    if (window.bootstrap) {
      button.setAttribute("data-bs-toggle", "tooltip");
      button.setAttribute("data-bs-placement", "left");
      button.setAttribute("data-bs-title", "Copied!");
      tooltip = new bootstrap.Tooltip(button, 
        { trigger: "manual", 
          customClass: "code-copy-button-tooltip",
          offset: [0, -8]});
      tooltip.show();    
    }
    setTimeout(function() {
      if (tooltip) {
        tooltip.hide();
        button.removeAttribute("data-bs-title");
        button.removeAttribute("data-bs-toggle");
        button.removeAttribute("data-bs-placement");
      }
      button.setAttribute("title", currentTitle);
      button.classList.remove('code-copy-button-checked');
    }, 1000);
    // clear code selection
    e.clearSelection();
  }
  const getTextToCopy = function(trigger) {
      const codeEl = trigger.previousElementSibling.cloneNode(true);
      for (const childEl of codeEl.children) {
        if (isCodeAnnotation(childEl)) {
          childEl.remove();
        }
      }
      return codeEl.innerText;
  }
  const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
    text: getTextToCopy
  });
  clipboard.on('success', onCopySuccess);
  if (window.document.getElementById('quarto-embedded-source-code-modal')) {
    // For code content inside modals, clipBoardJS needs to be initialized with a container option
    // TODO: Check when it could be a function (zenorocha/clipboard.js#860)
    const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
      text: getTextToCopy,
      container: window.document.getElementById('quarto-embedded-source-code-modal')
    });
    clipboardModal.on('success', onCopySuccess);
  }
    var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
    var mailtoRegex = new RegExp(/^mailto:/);
      var filterRegex = new RegExp('/' + window.location.host + '/');
    var isInternal = (href) => {
        return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
    }
    // Inspect non-navigation links and adorn them if external
 	var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)');
    for (var i=0; i<links.length; i++) {
      const link = links[i];
      if (!isInternal(link.href)) {
        // undo the damage that might have been done by quarto-nav.js in the case of
        // links that we want to consider external
        if (link.dataset.originalHref !== undefined) {
          link.href = link.dataset.originalHref;
        }
      }
    }
  function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
    const config = {
      allowHTML: true,
      maxWidth: 500,
      delay: 100,
      arrow: false,
      appendTo: function(el) {
          return el.parentElement;
      },
      interactive: true,
      interactiveBorder: 10,
      theme: 'quarto',
      placement: 'bottom-start',
    };
    if (contentFn) {
      config.content = contentFn;
    }
    if (onTriggerFn) {
      config.onTrigger = onTriggerFn;
    }
    if (onUntriggerFn) {
      config.onUntrigger = onUntriggerFn;
    }
    window.tippy(el, config); 
  }
  const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
  for (var i=0; i<noterefs.length; i++) {
    const ref = noterefs[i];
    tippyHover(ref, function() {
      // use id or data attribute instead here
      let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
      try { href = new URL(href).hash; } catch {}
      const id = href.replace(/^#\/?/, "");
      const note = window.document.getElementById(id);
      if (note) {
        return note.innerHTML;
      } else {
        return "";
      }
    });
  }
  const xrefs = window.document.querySelectorAll('a.quarto-xref');
  const processXRef = (id, note) => {
    // Strip column container classes
    const stripColumnClz = (el) => {
      el.classList.remove("page-full", "page-columns");
      if (el.children) {
        for (const child of el.children) {
          stripColumnClz(child);
        }
      }
    }
    stripColumnClz(note)
    if (id === null || id.startsWith('sec-')) {
      // Special case sections, only their first couple elements
      const container = document.createElement("div");
      if (note.children && note.children.length > 2) {
        container.appendChild(note.children[0].cloneNode(true));
        for (let i = 1; i < note.children.length; i++) {
          const child = note.children[i];
          if (child.tagName === "P" && child.innerText === "") {
            continue;
          } else {
            container.appendChild(child.cloneNode(true));
            break;
          }
        }
        if (window.Quarto?.typesetMath) {
          window.Quarto.typesetMath(container);
        }
        return container.innerHTML
      } else {
        if (window.Quarto?.typesetMath) {
          window.Quarto.typesetMath(note);
        }
        return note.innerHTML;
      }
    } else {
      // Remove any anchor links if they are present
      const anchorLink = note.querySelector('a.anchorjs-link');
      if (anchorLink) {
        anchorLink.remove();
      }
      if (window.Quarto?.typesetMath) {
        window.Quarto.typesetMath(note);
      }
      // TODO in 1.5, we should make sure this works without a callout special case
      if (note.classList.contains("callout")) {
        return note.outerHTML;
      } else {
        return note.innerHTML;
      }
    }
  }
  for (var i=0; i<xrefs.length; i++) {
    const xref = xrefs[i];
    tippyHover(xref, undefined, function(instance) {
      instance.disable();
      let url = xref.getAttribute('href');
      let hash = undefined; 
      if (url.startsWith('#')) {
        hash = url;
      } else {
        try { hash = new URL(url).hash; } catch {}
      }
      if (hash) {
        const id = hash.replace(/^#\/?/, "");
        const note = window.document.getElementById(id);
        if (note !== null) {
          try {
            const html = processXRef(id, note.cloneNode(true));
            instance.setContent(html);
          } finally {
            instance.enable();
            instance.show();
          }
        } else {
          // See if we can fetch this
          fetch(url.split('#')[0])
          .then(res => res.text())
          .then(html => {
            const parser = new DOMParser();
            const htmlDoc = parser.parseFromString(html, "text/html");
            const note = htmlDoc.getElementById(id);
            if (note !== null) {
              const html = processXRef(id, note);
              instance.setContent(html);
            } 
          }).finally(() => {
            instance.enable();
            instance.show();
          });
        }
      } else {
        // See if we can fetch a full url (with no hash to target)
        // This is a special case and we should probably do some content thinning / targeting
        fetch(url)
        .then(res => res.text())
        .then(html => {
          const parser = new DOMParser();
          const htmlDoc = parser.parseFromString(html, "text/html");
          const note = htmlDoc.querySelector('main.content');
          if (note !== null) {
            // This should only happen for chapter cross references
            // (since there is no id in the URL)
            // remove the first header
            if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
              note.children[0].remove();
            }
            const html = processXRef(null, note);
            instance.setContent(html);
          } 
        }).finally(() => {
          instance.enable();
          instance.show();
        });
      }
    }, function(instance) {
    });
  }
      let selectedAnnoteEl;
      const selectorForAnnotation = ( cell, annotation) => {
        let cellAttr = 'data-code-cell="' + cell + '"';
        let lineAttr = 'data-code-annotation="' +  annotation + '"';
        const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
        return selector;
      }
      const selectCodeLines = (annoteEl) => {
        const doc = window.document;
        const targetCell = annoteEl.getAttribute("data-target-cell");
        const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
        const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
        const lines = annoteSpan.getAttribute("data-code-lines").split(",");
        const lineIds = lines.map((line) => {
          return targetCell + "-" + line;
        })
        let top = null;
        let height = null;
        let parent = null;
        if (lineIds.length > 0) {
            //compute the position of the single el (top and bottom and make a div)
            const el = window.document.getElementById(lineIds[0]);
            top = el.offsetTop;
            height = el.offsetHeight;
            parent = el.parentElement.parentElement;
          if (lineIds.length > 1) {
            const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
            const bottom = lastEl.offsetTop + lastEl.offsetHeight;
            height = bottom - top;
          }
          if (top !== null && height !== null && parent !== null) {
            // cook up a div (if necessary) and position it 
            let div = window.document.getElementById("code-annotation-line-highlight");
            if (div === null) {
              div = window.document.createElement("div");
              div.setAttribute("id", "code-annotation-line-highlight");
              div.style.position = 'absolute';
              parent.appendChild(div);
            }
            div.style.top = top - 2 + "px";
            div.style.height = height + 4 + "px";
            div.style.left = 0;
            let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
            if (gutterDiv === null) {
              gutterDiv = window.document.createElement("div");
              gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
              gutterDiv.style.position = 'absolute';
              const codeCell = window.document.getElementById(targetCell);
              const gutter = codeCell.querySelector('.code-annotation-gutter');
              gutter.appendChild(gutterDiv);
            }
            gutterDiv.style.top = top - 2 + "px";
            gutterDiv.style.height = height + 4 + "px";
          }
          selectedAnnoteEl = annoteEl;
        }
      };
      const unselectCodeLines = () => {
        const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
        elementsIds.forEach((elId) => {
          const div = window.document.getElementById(elId);
          if (div) {
            div.remove();
          }
        });
        selectedAnnoteEl = undefined;
      };
        // Handle positioning of the toggle
    window.addEventListener(
      "resize",
      throttle(() => {
        elRect = undefined;
        if (selectedAnnoteEl) {
          selectCodeLines(selectedAnnoteEl);
        }
      }, 10)
    );
    function throttle(fn, ms) {
    let throttle = false;
    let timer;
      return (...args) => {
        if(!throttle) { // first call gets through
            fn.apply(this, args);
            throttle = true;
        } else { // all the others get throttled
            if(timer) clearTimeout(timer); // cancel #2
            timer = setTimeout(() => {
              fn.apply(this, args);
              timer = throttle = false;
            }, ms);
        }
      };
    }
      // Attach click handler to the DT
      const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
      for (const annoteDlNode of annoteDls) {
        annoteDlNode.addEventListener('click', (event) => {
          const clickedEl = event.target;
          if (clickedEl !== selectedAnnoteEl) {
            unselectCodeLines();
            const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
            if (activeEl) {
              activeEl.classList.remove('code-annotation-active');
            }
            selectCodeLines(clickedEl);
            clickedEl.classList.add('code-annotation-active');
          } else {
            // Unselect the line
            unselectCodeLines();
            clickedEl.classList.remove('code-annotation-active');
          }
        });
      }
  const findCites = (el) => {
    const parentEl = el.parentElement;
    if (parentEl) {
      const cites = parentEl.dataset.cites;
      if (cites) {
        return {
          el,
          cites: cites.split(' ')
        };
      } else {
        return findCites(el.parentElement)
      }
    } else {
      return undefined;
    }
  };
  var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
  for (var i=0; i<bibliorefs.length; i++) {
    const ref = bibliorefs[i];
    const citeInfo = findCites(ref);
    if (citeInfo) {
      tippyHover(citeInfo.el, function() {
        var popup = window.document.createElement('div');
        citeInfo.cites.forEach(function(cite) {
          var citeDiv = window.document.createElement('div');
          citeDiv.classList.add('hanging-indent');
          citeDiv.classList.add('csl-entry');
          var biblioDiv = window.document.getElementById('ref-' + cite);
          if (biblioDiv) {
            citeDiv.innerHTML = biblioDiv.innerHTML;
          }
          popup.appendChild(citeDiv);
        });
        return popup.innerHTML;
      });
    }
  }
});
</script>
</div> <!-- /content -->




</body></html>

About

Assessment of different AI methods, LLMs (llama)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published