<commit_before>// RkqqvYKque
"use strict";
var TweetStructure=function(options){
    var maxNumUser = 150;
    //this.Layout = options.layout; //Check
    var scene = options.scene;
    var graph = new Graph(options);
    var layoutOptions={};
    var lastTweetTime=new Date(Date.now() - 24*3600*1000); //seed date to 24 hours back
    var numNodes = 0;


    // var tweetsInContext=[];
    // tweetsInContext = tweetsInContext;

    graph.layout = new Layout.ForceDirected(graph, layoutOptions);
    //graph.layout.init(); //TODO: CALL WHEN EVERYTHING IS READY

    // options = {scene:drawing.scene};
    // var graph = new Graph(options);

    var makeConnections = function(origin,dest){
        graph.addEdge(origin,dest);
    };

    var drawGraph=function(tweet){
        //console.log("batch processing usernames");
        var user = tweet.user;
        var description = tweet.description;
        var retweet = tweet.retweet;

        var node = createUserNode(user);
        var panel = createTweetPanel(description);

        var edge = graph.addEdge(node, panel);
        edge.draw();

        graph.layout.init({iterations: 100000});
        //for(var i = 0; i < 2; i++){
        //    var node = createUserNode(usernames[i]);  //Small number of nodes for debugging animation.
        //}

    };

    var createUserNode = function(username){
        var location = lookupStartPosition(username);
        var userNode = new TwitterNode(username,null,null,location,0);
        userNode.id = numNodes; //NOT SURE
        graph.addNode(userNode);
       // userNode.mesh.position.copy(location); //CHECK
       // userNode.mesh._dirtyPosition = true;
        //userNode.mesh.geometry =  new THREE.SphereGeometry(6, 32, 32);

        //userNode.id = numNodes; //NOT SURE
        numNodes++; //NOT SURE.

        userNode.draw(location);

        return userNode;//Testing


    };

    var createTweetPanel = function(tweet){
        var location = lookupStartPosition(tweet);
        var tweetPanel = new TweetPanel(tweet,location,0);
        tweetPanel.id = numNodes;
        graph.addNode(tweetPanel);
        //tweetPanel.mesh.position.copy(location); //mesh is undefined...
        //tweetPanel.mesh._dirtyPosition = true;
        numNodes++;
        tweetPanel.draw(location);
        return tweetPanel; //Testing
    };

    var processTweets=function(tweets){
        //var numTweets = tweets.length;
        //lastTweetTime.setTime(new Date(tweets[numTweets-1].created_at).getTime());
        //doProcessTweets(tweets);
        console.log("Creating tweet panels!");
        tweets.forEach(function(tweet){
            createTweetPanel(tweet);
        })
    };
<commit_msg>Retweets working<commit_after>// RkqqvYKque
"use strict";
var TweetStructure=function(options){
    var maxNumUser = 150;
    //this.Layout = options.layout; //Check
    var scene = options.scene;
    var graph = new Graph(options);
    var layoutOptions={};
    var lastTweetTime=new Date(Date.now() - 24*3600*1000); //seed date to 24 hours back
    var numNodes = 0;
    var storedTweets = [];


    // var tweetsInContext=[];
    // tweetsInContext = tweetsInContext;

    graph.layout = new Layout.ForceDirected(graph, layoutOptions);
    //graph.layout.init(); //TODO: CALL WHEN EVERYTHING IS READY

    // options = {scene:drawing.scene};
    // var graph = new Graph(options);

    var makeConnections = function(origin,dest){
        graph.addEdge(origin,dest);
    };

    var drawGraph=function(tweet){
        //console.log("batch processing usernames");
        var user = tweet.user;
        var description = tweet.description;
        var retweet = tweet.retweet;

        if (retweet != null) {
            console.log("ITS A RETWEET BROS");
            var retweetNode = createUserNode(user);
            var node_id = getASCIIvalue(description);
            console.log(node_id);
            var retweetText = graph.getNode(node_id);
            if (retweetText != null) {
                var retweetEdge = graph.addEdge(retweetNode, retweetText);

                retweetEdge.draw();
            } else {
                retweetText = createTweetPanel(description);
                var originalNode = createUserNode(retweet);
                var tweetEdge = graph.addEdge(originalNode, retweetText);
                var retweetEdge = graph.addEdge(retweetNode, retweetText);

                tweetEdge.draw();
                retweetEdge.draw();
            }

        } else {

            var node = createUserNode(user);
            var panel = createTweetPanel(description);

            var edge = graph.addEdge(node, panel);
            edge.draw();
            storedTweets.push(description);

            //for(var i = 0; i < 2; i++){
            //    var node = createUserNode(usernames[i]);  //Small number of nodes for debugging animation.
            //}
        }
        graph.layout.init({iterations: 100000});

    };

    var getASCIIvalue = function(tweet) {
        var value = 0;
        for (var i = 0; i < tweet.length; i++) {
            value += tweet.charCodeAt(i);
        }
        return value;
    }

    var createUserNode = function(username){
        var location = lookupStartPosition(username);
        var userNode = new TwitterNode(username,null,null,location,0);
        userNode.id = numNodes; //NOT SURE
        graph.addNode(userNode);
       // userNode.mesh.position.copy(location); //CHECK
       // userNode.mesh._dirtyPosition = true;
        //userNode.mesh.geometry =  new THREE.SphereGeometry(6, 32, 32);

        //userNode.id = numNodes; //NOT SURE
        numNodes++; //NOT SURE.

        userNode.draw(location);

        return userNode;//Testing


    };

    var createTweetPanel = function(tweet){
        var location = lookupStartPosition(tweet);
        var tweetPanel = new TweetPanel(tweet,location,0);
        tweetPanel.id = getASCIIvalue(tweet);
        console.log(tweetPanel.id);
        //tweetPanel.id = numNodes;
        graph.addNode(tweetPanel);
        //tweetPanel.mesh.position.copy(location); //mesh is undefined...
        //tweetPanel.mesh._dirtyPosition = true;
        numNodes++;
        tweetPanel.draw(location);
        return tweetPanel; //Testing
    };

    var processTweets=function(tweets){
        //var numTweets = tweets.length;
        //lastTweetTime.setTime(new Date(tweets[numTweets-1].created_at).getTime());
        //doProcessTweets(tweets);
        console.log("Creating tweet panels!");
        tweets.forEach(function(tweet){
            createTweetPanel(tweet);
        })
    };

{'fraction_non_alphanumeric': 0.12399575564650599, 'fraction_numerical': 0.010004547521600727, 'mean_word_length': 2.267954432887568, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 3, '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': '5962600', 'n_tokens_mistral': 2033, 'n_tokens_neox': 1901, 'n_words': 412}