<commit_before>{% extends "base.html" %}

{% block style_css_extra %}
.bar {
    fill: steelblue;
}

.bar:hover {
    fill: gold;
}

.axis {
    font: 12px sans-serif;
}

.axis path, line {
    fill: none;
    stroke: #000000;
    shape-rendering: crispEdges;
}

.x.axis path {
    display: none;
}

.tipinfo {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 2px;
}

.tipinfo {
    line-height: 1;
    padding: 12px;
    font: 13px sans-serif;
    text-align: center;
}

/* Creates a small triangle extender for the tooltip */
.tipinfo:after {
    box-sizing: border-box;
    display: inline;
    font-size: 10px;
    width: 100%;
    line-height: 1;
    color: rgba(0, 0, 0, 0.8);
    content: "\25BC";
    position: absolute;
    text-align: center;
}

/* Style northward tooltips differently */
.tipinfo.n:after {
    margin: -1px 0 0 0;
    top: 100%;
    left: 0;
}

#retweets {
  display: inline;
}

#retweets div {
  float: left;
  height: 250px;
  margin: 10px;
}

{% endblock style_css_extra %}

{% block javascript_extra %}
<script type="text/javascript"
        src="https://rawgit.com/Caged/d3-tip/v0.6.7/index.js"></script>
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
<script type="text/javascript">
var date_path = window.location.pathname.split('/')[2];

d3.json("summary.json", function(e, summary) {
    if (e) return console.warn(e);
    d3.select('#title').text(summary.term);
    var num_tweets = parseInt(summary.num_tweets);
    d3.select('#num_tweets').text(num_tweets.toLocaleString());
    var t = new Date(summary.date);
    d3.select('#date').text($.format.date(t, 'yyyy-MM-dd HH:mm:ss'));
    // repeat for form field
    var inputText = d3.select('#text');
    inputText.property("value", summary.term);
    // 1.2 is completely arbitrary :)
    var newLength = summary.term.length * 1.2;
    if (newLength > 50) { newLength = 50 };
    inputText.property("size", newLength);
    d3.select('#count').property("value", num_tweets.toLocaleString());
});

var margin = {t: 20, r: 30, b: 120, l: 70};
var width = 480 - margin.l - margin.r;
var height = 480 - margin.t - margin.b;

var x = d3.scale.ordinal().range([0, width])
    .rangeRoundBands([0, width], .1);
var y = d3.scale.linear().range([height, 0]);

var x_axis = d3.svg.axis().scale(x).orient("bottom");
var y_axis = d3.svg.axis().scale(y).orient("left")
    .tickFormat(d3.format("d"));


d3.json("/api/searches/" + date_path + "/hashtags/", function(e, data) {
    if (e) return console.warn(e);
    chart("hashtags", data, "hashtag", "#");
});

d3.json("/api/searches/" + date_path + "/mentions/", function(e, data) {
    if (e) return console.warn(e);
    chart("mentions", data, "screen_name", "@");
});

d3.csv("count-domains.csv", function(e, data) {
    if (e) return console.warn(e);
    chart("domains", data, "url", null);
});

d3.csv("count-urls.csv", function(e, data) {
    if (e) return console.warn(e);
    chart("urls", data, "url", null);
});

d3.csv("count-followers.csv", function(e, data) {
    if (e) return console.warn(e);
    chart("followers", data, "user", "from:");
});

d3.csv("follow-ratio.csv", function(e, data) {
    if (e) return console.warn(e);
    chart("follow-ratio", data, "user", "from:");
});

twttr.ready(function() {
  d3.csv("retweets.csv", function(e, data) {
      if (e) return console.warn(e);
      for (var i in data) {
          var id = data[i].tweet_id;
          $("#retweets").append('<div id="tweet-' + id + '"></div>');
          twttr.widgets.createTweet(id, document.getElementById('tweet-' + id), {"cards": "hidden"});
          if (i > 50) break;
      };
  });
});

var media_counts = {};
d3.csv("count-media.csv", function(e, data) {
    if (e) return console.warn(e);
    for (i in data) {
        media_counts[data[i]["file"]] = data[i]["count"];
    };
    data.sort(function(a, b) { return b.count - a.count; });
    top_ten = data.slice(0, 10);
    var media_row = d3.select("#media")
        .append("div")
            .attr("class", "image row");

    media_row.selectAll(".image .row")
        .data(top_ten)
      .enter()
        .append("div")
            .attr("class", "item")
            .text(function(d) { return d.count; })
        .append("a")
            .attr("href", function(d) { return "media/" + d.file; })
        .append("img")
            .attr("width", "100")
            .attr("src", function(d) { return "media/" + d.file; });

<commit_msg>top 10<commit_after>{% extends "base.html" %}

{% block style_css_extra %}
.bar {
    fill: steelblue;
}

.bar:hover {
    fill: gold;
}

.axis {
    font: 12px sans-serif;
}

.axis path, line {
    fill: none;
    stroke: #000000;
    shape-rendering: crispEdges;
}

.x.axis path {
    display: none;
}

.tipinfo {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 2px;
}

.tipinfo {
    line-height: 1;
    padding: 12px;
    font: 13px sans-serif;
    text-align: center;
}

/* Creates a small triangle extender for the tooltip */
.tipinfo:after {
    box-sizing: border-box;
    display: inline;
    font-size: 10px;
    width: 100%;
    line-height: 1;
    color: rgba(0, 0, 0, 0.8);
    content: "\25BC";
    position: absolute;
    text-align: center;
}

/* Style northward tooltips differently */
.tipinfo.n:after {
    margin: -1px 0 0 0;
    top: 100%;
    left: 0;
}

#retweets {
  display: inline;
}

#retweets div {
  float: left;
  height: 250px;
  margin: 10px;
}

{% endblock style_css_extra %}

{% block javascript_extra %}
<script type="text/javascript"
        src="https://rawgit.com/Caged/d3-tip/v0.6.7/index.js"></script>
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
<script type="text/javascript">
var date_path = window.location.pathname.split('/')[2];

d3.json("summary.json", function(e, summary) {
    if (e) return console.warn(e);
    d3.select('#title').text(summary.term);
    var num_tweets = parseInt(summary.num_tweets);
    d3.select('#num_tweets').text(num_tweets.toLocaleString());
    var t = new Date(summary.date);
    d3.select('#date').text($.format.date(t, 'yyyy-MM-dd HH:mm:ss'));
    // repeat for form field
    var inputText = d3.select('#text');
    inputText.property("value", summary.term);
    // 1.2 is completely arbitrary :)
    var newLength = summary.term.length * 1.2;
    if (newLength > 50) { newLength = 50 };
    inputText.property("size", newLength);
    d3.select('#count').property("value", num_tweets.toLocaleString());
});

var margin = {t: 20, r: 30, b: 120, l: 70};
var width = 480 - margin.l - margin.r;
var height = 480 - margin.t - margin.b;

var x = d3.scale.ordinal().range([0, width])
    .rangeRoundBands([0, width], .1);
var y = d3.scale.linear().range([height, 0]);

var x_axis = d3.svg.axis().scale(x).orient("bottom");
var y_axis = d3.svg.axis().scale(y).orient("left")
    .tickFormat(d3.format("d"));


d3.json("/api/searches/" + date_path + "/hashtags/", function(e, data) {
    if (e) return console.warn(e);
    chart("hashtags", data, "hashtag", "#");
});

d3.json("/api/searches/" + date_path + "/mentions/", function(e, data) {
    if (e) return console.warn(e);
    chart("mentions", data, "screen_name", "@");
});

d3.csv("count-domains.csv", function(e, data) {
    if (e) return console.warn(e);
    chart("domains", data, "url", null);
});

d3.csv("count-urls.csv", function(e, data) {
    if (e) return console.warn(e);
    chart("urls", data, "url", null);
});

d3.csv("count-followers.csv", function(e, data) {
    if (e) return console.warn(e);
    chart("followers", data, "user", "from:");
});

d3.csv("follow-ratio.csv", function(e, data) {
    if (e) return console.warn(e);
    chart("follow-ratio", data, "user", "from:");
});

twttr.ready(function() {
  d3.csv("retweets.csv", function(e, data) {
      if (e) return console.warn(e);
      for (var i in data) {
          var id = data[i].tweet_id;
          $("#retweets").append('<div id="tweet-' + id + '"></div>');
          twttr.widgets.createTweet(id, document.getElementById('tweet-' + id), {"cards": "hidden"});
          if (i > 10) break;
      };
  });
});

var media_counts = {};
d3.csv("count-media.csv", function(e, data) {
    if (e) return console.warn(e);
    for (i in data) {
        media_counts[data[i]["file"]] = data[i]["count"];
    };
    data.sort(function(a, b) { return b.count - a.count; });
    top_ten = data.slice(0, 10);
    var media_row = d3.select("#media")
        .append("div")
            .attr("class", "image row");

    media_row.selectAll(".image .row")
        .data(top_ten)
      .enter()
        .append("div")
            .attr("class", "item")
            .text(function(d) { return d.count; })
        .append("a")
            .attr("href", function(d) { return "media/" + d.file; })
        .append("img")
            .attr("width", "100")
            .attr("src", function(d) { return "media/" + d.file; });


{'fraction_non_alphanumeric': 0.2025203524032564, 'fraction_numerical': 0.023642243782759004, 'mean_word_length': 2.9893238434163703, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 21, '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': '6778147', 'n_tokens_mistral': 3478, 'n_tokens_neox': 3296, 'n_words': 705}