function onCollsAutoResponse($sender, $args)
    {
        //$s = json_encode($args);
        //echo "COLLS AUTORESPONSE: ", htmlspecialchars($s), "\r\n";
    }
}
function queuedComparator($value)
{
    return $value == TASK_STATUS_QUEUED;
}
// Initializes new session with the serializer object and the keys.
$session = new \Semantria\Session(CONSUMER_KEY, CONSUMER_SECRET, NULL, NULL, TRUE);
// Initialize session callback handler
$callback = new SessionCallbackHandler();
$session->setCallbackHandler($callback);
$subscription = $session->getSubscription();
// A dictionary that keeps IDs of sent documents and their statuses.
// It's required to make sure that we get correct documents from the API.
$tracker = array();
$documets = array();
print "Reading collection from file...\n";
$file = fopen("source.txt", "r");
if (!$file) {
    print "";
    exit(1);
}
while (($line = fgets($file)) !== FALSE) {
    $initialTexts[] = $line;
}
if (!feof($file)) {
    echo "Error: unexpected fgets() fail\n";