<commit_before>%%inherit(file="../layout.haml")
%%block(name="title")
  &= document.title

- from dexter.helpers import format_paragraphs
- from urllib import quote_plus

#show-document
  %article
    %section.heading
      %h2&= document.title
      .url
        %a(href=document.url, target='_blank')&= document.url
      .row
        .col-sm-2
          .timestamp
            %i.fa.fa-calendar
            - if document.published_at:
              &= document.published_at.strftime('%Y-%m-%d')
        .col-sm-2
          .medium
            %i.fa.fa-building-o
              &= document.medium.name
        .col-sm-2
          .author
            %i.fa.fa-user
            - if document.author:
                &= document.author.name
        .col-sm-4

    %section.tabs
      .row
        .col-sm-5
          .article-text(dataOriginal=document.text.replace("\r", "\n"))
            = format_paragraphs(document.text)
        .col-sm-7
          %ul.nav.nav-tabs
            %li.active
              %a(href="#sources-tab", dataToggle="tab")
                Sources
                %span.badge&= len(document.sources)
            %li
              %a(href="#people-tab", dataToggle="tab")
                People
                %span.badge&= len(document.people())
            %li
              %a(href="#orgs-tab", dataToggle="tab")
                Organisations
                %span.badge&= len(document.organisations())
            %li
              %a(href="#places-tab", dataToggle="tab")
                Places
                %span.badge&= len(document.places())
            %li
              %a(href="#keywords-tab", dataToggle="tab")
                Keywords
                %span.badge&= len(document.keywords)

          .tab-content
            #sources-tab.tab-pane.active
              %h3 Sources
              %table.table.table-striped.table-condensed.entities
                %thead
                  %tr
                    %th Name
                    %th Quoted?
                    %th Photo?
                    %th Named?
                %tbody
                  - sources = sorted(document.sources, key=lambda s: s.entity.name)
                  - for ds in sources:
                    %tr(dataOffsets=ds.offset_list)
                      %td
                        %a(href= url_for('show_entity', group=ds.entity.group, name=ds.entity.name))&=ds.entity.name
                        - if ds.person and ds.person.gender:
                          %span.text-muted(title=ds.person.gender.name)
                            %strong&=
                              " - " + ds.person.gender.abbr()
                        - if ds.person and ds.person.race:
                          %span.text-muted(title=ds.person.race.name)
                          %strong&=
                            " (" + ds.person.race.abbr() + ")"

                      %td
                        &= 'yes' if ds.quoted else 'no'
                        - if len(ds.utterances()) > 0:
                          %span.badge&= len(ds.utterances())
                      %td&= 'yes' if ds.photographed else 'no'
                      %td&= 'yes' if ds.named else 'no'
                    - for q in ds.utterances():
                      %tr.quotation(dataOffsets=('%d:%d' % (q.offset, q.length) if q.offset else ''))
                        %td(colspan="4")&= q.quote

            #people-tab.tab-pane
              %h3 People
              %table.table.table-striped.table-condensed.entities
                %thead
                  %th Name
                  %th.text-center Race
                  %th.text-center Gender
                  %th Relevance
                - for dp in document.people():
                  - person = dp.entity.person

                  %tr(dataOffsets=dp.offset_list)
                    %td
                      %a(href= url_for('show_entity', group=dp.entity.group, name=dp.entity.name))&=dp.entity.name
                    %td.text-center
                      - if person:
                        - if person.race:
                          %span.text-muted(title=ds.person.race.name)
                            %strong&=
                              ds.person.race.abbr()
                    %td.text-center
                      - if person:<commit_msg>Show source function when available, on Show Article page.<commit_after>%%inherit(file="../layout.haml")
%%block(name="title")
  &= document.title

- from dexter.helpers import format_paragraphs
- from urllib import quote_plus

#show-document
  %article
    %section.heading
      %h2&= document.title
      .url
        %a(href=document.url, target='_blank')&= document.url
      .row
        .col-sm-2
          .timestamp
            %i.fa.fa-calendar
            - if document.published_at:
              &= document.published_at.strftime('%Y-%m-%d')
        .col-sm-2
          .medium
            %i.fa.fa-building-o
              &= document.medium.name
        .col-sm-2
          .author
            %i.fa.fa-user
            - if document.author:
                &= document.author.name
        .col-sm-4

    %section.tabs
      .row
        .col-sm-5
          .article-text(dataOriginal=document.text.replace("\r", "\n"))
            = format_paragraphs(document.text)
        .col-sm-7
          %ul.nav.nav-tabs
            %li.active
              %a(href="#sources-tab", dataToggle="tab")
                Sources
                %span.badge&= len(document.sources)
            %li
              %a(href="#people-tab", dataToggle="tab")
                People
                %span.badge&= len(document.people())
            %li
              %a(href="#orgs-tab", dataToggle="tab")
                Organisations
                %span.badge&= len(document.organisations())
            %li
              %a(href="#places-tab", dataToggle="tab")
                Places
                %span.badge&= len(document.places())
            %li
              %a(href="#keywords-tab", dataToggle="tab")
                Keywords
                %span.badge&= len(document.keywords)

          .tab-content
            #sources-tab.tab-pane.active
              %h3 Sources
              %table.table.table-striped.table-condensed.entities
                %thead
                  %tr
                    %th Name
                    %th
                    %th Quoted?
                    %th Photo?
                    %th Named?
                %tbody
                  - sources = sorted(document.sources, key=lambda s: s.entity.name)
                  - for ds in sources:
                    %tr(dataOffsets=ds.offset_list)
                      %td
                        %a(href= url_for('show_entity', group=ds.entity.group, name=ds.entity.name))&=ds.entity.name
                        - if ds.person and ds.person.gender:
                          %span.text-muted(title=ds.person.gender.name)
                            %strong&=
                              " - " + ds.person.gender.abbr()
                        - if ds.person and ds.person.race:
                          %span.text-muted(title=ds.person.race.name)
                          %strong&=
                            " (" + ds.person.race.abbr() + ")"
                      %td
                        - if ds.function:
                          %span.label.label-default&=ds.function.name
                      %td
                        &= 'yes' if ds.quoted else 'no'
                        - if len(ds.utterances()) > 0:
                          %span.badge&= len(ds.utterances())
                      %td&= 'yes' if ds.photographed else 'no'
                      %td&= 'yes' if ds.named else 'no'
                    - for q in ds.utterances():
                      %tr.quotation(dataOffsets=('%d:%d' % (q.offset, q.length) if q.offset else ''))
                        %td(colspan="5")&= q.quote

            #people-tab.tab-pane
              %h3 People
              %table.table.table-striped.table-condensed.entities
                %thead
                  %th Name
                  %th.text-center Race
                  %th.text-center Gender
                  %th Relevance
                - for dp in document.people():
                  - person = dp.entity.person

                  %tr(dataOffsets=dp.offset_list)
                    %td
                      %a(href= url_for('show_entity', group=dp.entity.group, name=dp.entity.name))&=dp.entity.name
                    %td.text-center
                      - if person:
                        - if person.race:
                          %span.text-muted(title=ds.person.race.name)
                            %strong&=
                              ds.person.race.abbr()
                    %td.text-center
                      - if person:
{'fraction_non_alphanumeric': 0.12116738587326822, 'fraction_numerical': 0.0024982966159436746, 'mean_word_length': 1.0557889822595705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '955375', 'n_tokens_mistral': 2479, 'n_tokens_neox': 2332, 'n_words': 396}