<commit_before>package Kalamar::Plugin::KalamarHelpers;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON 'decode_json';
use Mojo::JSON::Pointer;
use Mojo::ByteStream 'b';
use Mojo::Util qw/xml_escape/;

sub register {
  my ($plugin, $mojo) = @_;

  # Embed the korap architecture image
  $mojo->helper(
    korap_overview => sub {
      my $c = shift;
      my $scope = shift;

      my $url = $c->url_with('/img/korap-overview.svg');

      my $base = $c->url_for('index');
      if ($base->path->parts->[0]) {
	$base->path->trailing_slash(1);
      };

      # If there is a different base - append this as a base
      $url->query([base => $base->to_abs // '/']);

      $url->fragment($scope);

      return $c->tag('object',
	data => $url,
	type => 'image/svg+xml',
	alt  => $c->loc('korap_overview'),
	id   => 'overview'
      );
    }
  );

  # Documentation link<commit_msg>Adjustments for subdirectory serving (7)<commit_after>package Kalamar::Plugin::KalamarHelpers;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON 'decode_json';
use Mojo::JSON::Pointer;
use Mojo::ByteStream 'b';
use Mojo::Util qw/xml_escape/;

sub register {
  my ($plugin, $mojo) = @_;

  # Embed the korap architecture image
  $mojo->helper(
    korap_overview => sub {
      my $c = shift;
      my $scope = shift;

      my $url = $c->url_with('/img/korap-overview.svg');

      my $base = $c->url_for('index');
      if ($base->path->parts->[0]) {
	$base->path->trailing_slash(1);
      };

      # If there is a different base - append this as a base
      $url->query([base => $base // '/']);

      $url->fragment($scope);

      return $c->tag('object',
	data => $url,
	type => 'image/svg+xml',
	alt  => $c->loc('korap_overview'),
	id   => 'overview'
      );
    }
  );

  # Documentation link
{'fraction_non_alphanumeric': 0.1887213847012842, 'fraction_numerical': 0.0027917364600781687, 'mean_word_length': 3.0727272727272728, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7303121', 'n_tokens_mistral': 655, 'n_tokens_neox': 637, 'n_words': 143}