<commit_before><?php 
session_start();
require_once("twitterauth/twitteroauth.php"); //Path to twitteroauth library
 
//$twitteruser = "kaceykaso";
$twitteruser = html_entity_decode($_POST['screenname']);
$notweets = 30;
$consumerkey = "<KEY>";
$consumersecret = "<KEY>";
$accesstoken = "<KEY>";
$accesstokensecret = "<KEY>";
 
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
  $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
  return $connection;
}
 
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
 
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
 
//echo json_encode($tweets);
$encode = json_encode($tweets);

//Parse request
$response = json_decode($encode);

//Global vars
$time = '';
$tweets = array();
//Go through tweets
foreach($response as $tweet)
{
  $time = "{$tweet->created_at}"; //Save latest time
  $tweets[] = "{$tweet->text}"; //Store tweet text
}
$tweets_count = count($tweets); //Count da tweets!
$reply = "We scored the last $tweets_count tweets by @$twitteruser, ending at $time:"; //Tell user whats what

// Import txt
ini_set("auto_detect_line_endings", 1);
$scores = array(); //this is where data from data.txt will be stored

$handle = fopen("AFINN-111.csv","r") or die("EPIC FAIL!");

while (($row = fgetcsv($handle, 10000, ",")) !== FALSE) {
	//$row = explode(",", $data);
	$word = trim(strtolower($row[0]));
	$scores[$word] = trim($row[1]);
}

fclose($handle);<commit_msg>update tweets.php<commit_after><?php 
session_start();
require_once("twitterauth/twitteroauth.php"); //Path to twitteroauth library
 
//$twitteruser = "kaceykaso";
$twitteruser = html_entity_decode($_POST['screenname']);
$notweets = 30;

// add twitter auth keys here
$consumerkey = "";
$consumersecret = "";
$accesstoken = "";
$accesstokensecret = "";
 
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
  $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
  return $connection;
}
 
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
 
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
 
//echo json_encode($tweets);
$encode = json_encode($tweets);

//Parse request
$response = json_decode($encode);

//Global vars
$time = '';
$tweets = array();
//Go through tweets
foreach($response as $tweet)
{
  $time = "{$tweet->created_at}"; //Save latest time
  $tweets[] = "{$tweet->text}"; //Store tweet text
}
$tweets_count = count($tweets); //Count da tweets!
$reply = "We scored the last $tweets_count tweets by @$twitteruser, ending at $time:"; //Tell user whats what

// Import txt
ini_set("auto_detect_line_endings", 1);
$scores = array(); //this is where data from data.txt will be stored

$handle = fopen("AFIN-111.csv","r") or die("EPIC FAIL!"); //fixed filename CSV error

while (($row = fgetcsv($handle, 10000, ",")) !== FALSE) {
	//$row = explode(",", $data);
	$word = trim(strtolower($row[0]));
	$scores[$word] = trim($row[1]);
}

fclose($handle);
{'fraction_non_alphanumeric': 0.18534094322619404, 'fraction_numerical': 0.009011715229798739, 'mean_word_length': 5.9375, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '7405264', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1149, 'n_words': 253}