<commit_before><?php
/**
 * Created by IntelliJ IDEA.
 * User: <NAME>
 * Date: 3/26/2017
 * Time: 2:20 PM
 */

use DBA\RandOrderFilter;

require_once(dirname(__FILE__) . "/inc/load.php");
$TEMPLATE = new Template("views/compare2");
$OBJECTS['pageTitle'] = "Cineast Evaluator";

// TODO: do pooling of comparisons here
// TODO: handle submitted responses
// TODO: open sessions
// TODO: validate sessions



$oF = new RandOrderFilter(1);
$entry = $FACTORIES::getResultTupleFactory()->filter(array($FACTORIES::ORDER => $oF), 1);

if($entry == null){
  UI::addErrorMessage("There is no data available!");
}
else{
  if(mt_rand(0,1) == 0) {
    $mediaObject1 = $FACTORIES::getMediaObjectFactory()->get($entry->getObjectId1());
    $mediaObject2 = $FACTORIES::getMediaObjectFactory()->get($entry->getObjectId2());
  }
  else{
    $mediaObject1 = $FACTORIES::getMediaObjectFactory()->get($entry->getObjectId2());
    $mediaObject2 = $FACTORIES::getMediaObjectFactory()->get($entry->getObjectId1());
  }
  
  $value1 = new DataSet();
  $value2 = new DataSet();
  
  $value1->addValue('objData', array("data:".mime_content_type($mediaObject1->getFilename()).";base64,".base64_encode(file_get_contents($mediaObject1->getFilename()))));
  $value2->addValue('objData', array("data:".mime_content_type($mediaObject2->getFilename()).";base64,".base64_encode(file_get_contents($mediaObject2->getFilename()))));
  
  $mediaType1 = $FACTORIES::getMediaTypeFactory()->get($mediaObject1->getMediaTypeId());
  $mediaType2 = $FACTORIES::getMediaTypeFactory()->get($mediaObject2->getMediaTypeId());
  
  $value1->addValue('template', $mediaType1->getTemplate());
  $value2->addValue('template', $mediaType2->getTemplate());<commit_msg>renamed entry to better name<commit_after><?php
/**
 * Created by IntelliJ IDEA.
 * User: <NAME>
 * Date: 3/26/2017
 * Time: 2:20 PM
 */

use DBA\RandOrderFilter;

require_once(dirname(__FILE__) . "/inc/load.php");
$TEMPLATE = new Template("views/compare2");
$OBJECTS['pageTitle'] = "Cineast Evaluator";

// TODO: do pooling of comparisons here
// TODO: handle submitted responses
// TODO: open sessions
// TODO: validate sessions



$oF = new RandOrderFilter(1);
$resultSet = $FACTORIES::getResultTupleFactory()->filter(array($FACTORIES::ORDER => $oF), 1);

if($resultSet == null){
  UI::addErrorMessage("There is no data available!");
}
else{
  if(mt_rand(0,1) == 0) {
    $mediaObject1 = $FACTORIES::getMediaObjectFactory()->get($resultSet->getObjectId1());
    $mediaObject2 = $FACTORIES::getMediaObjectFactory()->get($resultSet->getObjectId2());
  }
  else{
    $mediaObject1 = $FACTORIES::getMediaObjectFactory()->get($resultSet->getObjectId2());
    $mediaObject2 = $FACTORIES::getMediaObjectFactory()->get($resultSet->getObjectId1());
  }
  
  $value1 = new DataSet();
  $value2 = new DataSet();
  
  $value1->addValue('objData', array("data:".mime_content_type($mediaObject1->getFilename()).";base64,".base64_encode(file_get_contents($mediaObject1->getFilename()))));
  $value2->addValue('objData', array("data:".mime_content_type($mediaObject2->getFilename()).";base64,".base64_encode(file_get_contents($mediaObject2->getFilename()))));
  
  $mediaType1 = $FACTORIES::getMediaTypeFactory()->get($mediaObject1->getMediaTypeId());
  $mediaType2 = $FACTORIES::getMediaTypeFactory()->get($mediaObject2->getMediaTypeId());
  
  $value1->addValue('template', $mediaType1->getTemplate());
  $value2->addValue('template', $mediaType2->getTemplate());
{'fraction_non_alphanumeric': 0.19163059163059162, 'fraction_numerical': 0.027705627705627706, 'mean_word_length': 6.617582417582417, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 53, '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': '3454988', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1143, 'n_words': 167}