<commit_before><?php

if ($argc < 1)
    die; // only run from command line
// ----- params -----
set_time_limit(0);
error_reporting(E_ALL);
include_once "../../config.php";
include_once BASE_FILE . "/querybins.php";
include_once BASE_FILE . '/common/functions.php';
include_once BASE_FILE . '/capture/common/functions.php';

require BASE_FILE . 'capture/common/tmhOAuth/tmhOAuth.php';
// ----- connection -----
$dbh = pdo_connect();

$user_ids = array();
$bin_name = "";
$list_name = "";

// instead of specying usernames, you can also fetch usernames from a specific list in the database
if (!empty($list_name)) {
    $q = $dbh->prepare("SELECT list_id FROM " . $bin_name . "_lists WHERE list_name = '" . $list_name . "'");
    if ($q->execute()) {
        $list_id = $q->fetchAll(PDO::FETCH_COLUMN, 0);
        $list_id = $list_id[0];
        $q = $dbh->prepare("SELECT user_id FROM penw_lists_membership WHERE list_id = $list_id");
        if ($q->execute()) {
            $user_ids = $q->fetchAll(PDO::FETCH_COLUMN, 0);
        }
    }
}

if (empty($bin_name))
    die("bin_name not set\n");
if (empty($user_ids))<commit_msg>added possibility to retrieve existing users from a set of tweets<commit_after><?php

if ($argc < 1)
    die; // only run from command line
// ----- params -----
set_time_limit(0);
error_reporting(E_ALL);
include_once "../../config.php";
include_once BASE_FILE . "/querybins.php";
include_once BASE_FILE . '/common/functions.php';
include_once BASE_FILE . '/capture/common/functions.php';

require BASE_FILE . 'capture/common/tmhOAuth/tmhOAuth.php';
// ----- connection -----
$dbh = pdo_connect();

$user_ids = array();
$bin_name = "";
$list_name = "";

// instead of specying usernames, you can also fetch usernames from a specific list in the database
if (!empty($list_name)) {
    $q = $dbh->prepare("SELECT list_id FROM " . $bin_name . "_lists WHERE list_name = '" . $list_name . "'");
    if ($q->execute()) {
        $list_id = $q->fetchAll(PDO::FETCH_COLUMN, 0);
        $list_id = $list_id[0];
        $q = $dbh->prepare("SELECT user_id FROM penw_lists_membership WHERE list_id = $list_id");
        if ($q->execute()) {
            $user_ids = $q->fetchAll(PDO::FETCH_COLUMN, 0);
        }
    }
}
// you can also retrieve the users from a set of tweets
if (empty($user_ids)) {
    $q = $dbh->prepare("SELECT DISTINCT(from_user_name) FROM " . $bin_name . "_tweets");
    if ($q->execute()) {
        $user_ids = $q->fetchAll(PDO::FETCH_COLUMN, 0);
    }
}

if (empty($bin_name))
    die("bin_name not set\n");
if (empty($user_ids))
{'fraction_non_alphanumeric': 0.18054474708171206, 'fraction_numerical': 0.004280155642023347, 'mean_word_length': 3.256622516556291, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 18, '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': '4006116', 'n_tokens_mistral': 916, 'n_tokens_neox': 911, 'n_words': 209}