<commit_before>digraph G {
  charset="UTF-8";
  graph [truecolor=true,bgcolor=transparent];
  rankdir="<%= @direction -%>";

  roota [label="",shape=circle];

  <%- @graph.tokens1.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
    <%= node token.id, token.relation.to_s.upcase,                 shape: :box -%>

    <%- if token.relation -%>
      <%= edge (token.head ? token.head.id : :root), token.id, '', weight: 1.0, color: :orange -%>
    <%- end -%>

    <%- token.slashes.each do |(relation, target)| -%>
      <%= edge token.id, target, relation.to_s.upcase, weight: 0.0, color: :blue, style: :dashed %>
    <%- end -%>
  <%- end -%>  

  <%- @graph.tokens1.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
    <%= edge token.id, "T#{token.id}", nil, weight: 10, arrowhead: :none -%>
  <%- end -%>  

  {
    rank="same";

    <%- @graph.tokens1.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
      <%= node "T#{token.id}", token.form, shape: :none -%>
    <%- end -%>  

    <%= @graph.tokens1.select { |t| t.empty_token_sort != 'P' }.map { |token| "T#{token.id}" }.join('->') -%> [style="invis"];
  }

  rootb [label="",shape=circle];

  <%- @graph.tokens2.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
    <%= node token.id, token.relation.to_s.upcase,                 shape: :box -%>

    <%- if token.relation -%>
      <%= edge (token.head ? token.head.id : :root), token.id, '', weight: 1.0, color: :orange -%>
    <%- end -%>

    <%- token.slashes.each do |(relation, target)| -%>
      <%= edge token.id, target, relation.to_s.upcase, weight: 0.0, color: :blue, style: :dashed %>
    <%- end -%>
  <%- end -%>  

  <%- @graph.tokens2.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
    <%= edge token.id, "T#{token.id}", nil, weight: 10, arrowhead: :none -%>
  <%- end -%>  

  {
    rank="same";

    <%- @graph.tokens2.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
      <%= node "T#{token.id}", token.form, shape: :none -%>
    <%- end -%>  

    <%= @graph.tokens2.select { |t| t.empty_token_sort != 'P' }.map { |token| "T#{token.id}" }.join('->') -%> [style="invis"];
  }

  <%- @graph.alignments.each do |x, y| -%>
    "T#{x}" -> "T#{y}" [style=dashed,color=blue,dir=none];
  <%- end -%>  
}<commit_msg>Make "aligned-modern" viz handle multiple L/R graphs<commit_after>digraph G {
  charset="UTF-8";
  graph [truecolor=true,bgcolor=transparent];
  rankdir="<%= @direction -%>";

  <%- @graph.left.each_with_index do |tokens, i| -%>
    <%= "rootL#{i}" -%> [label="",shape=circle];

    <%- tokens.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
      <%= node token.id, token.relation.to_s.upcase,                 shape: :box -%>

      <%- if token.relation -%>
        <%= edge (token.head ? token.head.id : "rootL#{i}"), token.id, '', weight: 1.0, color: :orange -%>
      <%- end -%>

      <%- token.slashes.each do |(relation, target)| -%>
        <%= edge token.id, target, relation.to_s.upcase, weight: 0.0, color: :blue, style: :dashed %>
      <%- end -%>
    <%- end -%>

    <%- tokens.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
      <%= edge token.id, "T#{token.id}", nil, weight: 10, arrowhead: :none -%>
    <%- end -%>
  <%- end -%>

  {
    rank="same";

    <%- @graph.left.each do |tokens| -%>
      <%- tokens.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
        <%= node "T#{token.id}", token.form, shape: :none -%>
      <%- end -%>

      <%= tokens.select { |t| t.empty_token_sort != 'P' }.map { |token| "T#{token.id}" }.join('->') -%> [style="invis"];
    <%- end -%>
  }

  <%- @graph.right.each_with_index do |tokens, i| -%>
    <%= "rootR#{i}" -%> [label="",shape=circle];

    <%- tokens.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
      <%= node token.id, token.relation.to_s.upcase,                 shape: :box -%>

      <%- if token.relation -%>
        <%= edge token.id, (token.head ? token.head.id : "rootR#{i}"), '', weight: 1.0, color: :orange -%>
      <%- end -%>

      <%- token.slashes.each do |(relation, target)| -%>
        <%= edge token.id, target, relation.to_s.upcase, weight: 0.0, color: :blue, style: :dashed %>
      <%- end -%>
    <%- end -%>

    <%- tokens.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
      <%= edge "T#{token.id}", token.id, nil, weight: 10, arrowhead: :none -%>
    <%- end -%>
  <%- end -%>

  {
    rank="same";

    <%- @graph.right.each do |tokens| -%>
      <%- tokens.select { |t| t.empty_token_sort != 'P' }.each do |token| -%>
        <%= node "T#{token.id}", token.form, shape: :none -%>
      <%- end -%>

      <%= tokens.select { |t| t.empty_token_sort != 'P' }.map { |token| "T#{token.id}" }.join('->') -%> [style="invis"];
    <%- end -%>
  }

  <%- @graph.alignments.each do |x, y| -%>
    <%= "T#{x}" -%> -> <%= "T#{y}" -%> [style=dashed,color=blue,dir=none];
  <%- end -%>
}
{'fraction_non_alphanumeric': 0.25953582240161455, 'fraction_numerical': 0.0068617558022199794, 'mean_word_length': 2.497529992942837, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2400156', 'n_tokens_mistral': 2140, 'n_tokens_neox': 2007, 'n_words': 378}