<commit_before><% if @embedded %>
  <script>
  requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
  if(!window.Plotly) {{require(['plotly'], function(plotly) {window.Plotly=plotly})}}
  </script>
<% else %>
  <script>
  <%= LOCAL_PLOTLY_JS %>
  </script>
<% end %>

<div id="<%= @id %>" style="height: 100%; width: 100%;" class="plotly-graph-div"></div>

<script>
require(["plotly"], function(Plotly) {
  window.PLOTLYENV=window.PLOTLYENV || {}
  window.PLOTLYENV.BASE_URL='https://plot.ly'

  Plotly.newPlot(
    '<%= @id %>',
    <%= @data.to_json %>,
    <%= @layout.to_json %>,
    <%= @config.to_json %>
  )

  window.addEventListener('resize', function() {
    Plotly.Plots.resize(document.getElementById('<%= @id %>'))
  })
})
</script><commit_msg>Use require.js only when embedded in Ruby<commit_after><% if @embedded %>
  <script>
  requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
  if(!window.Plotly) {{require(['plotly'], function(plotly) {window.Plotly=plotly})}}
  </script>
<% else %>
  <script>
  <%= LOCAL_PLOTLY_JS %>
  </script>
<% end %>

<div id="<%= @id %>" style="height: 100%; width: 100%;" class="plotly-graph-div"></div>

<script>
<% if @embedded %> require(["plotly"], function(Plotly) { <% end %>
  window.PLOTLYENV=window.PLOTLYENV || {}
  window.PLOTLYENV.BASE_URL='https://plot.ly'

  Plotly.newPlot(
    '<%= @id %>',
    <%= @data.to_json %>,
    <%= @layout.to_json %>,
    <%= @config.to_json %>
  )

  window.addEventListener('resize', function() {
    Plotly.Plots.resize(document.getElementById('<%= @id %>'))
  })
<% if @embedded %> }) <% end %>
</script>
{'fraction_non_alphanumeric': 0.2463855421686747, 'fraction_numerical': 0.007228915662650603, 'mean_word_length': 4.289808917197452, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 4, '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': '1993971', 'n_tokens_mistral': 686, 'n_tokens_neox': 621, 'n_words': 91}