Exemplo n.º 1
0
 public function remove(Recommendation $recommendation)
 {
     if (!array_key_exists($recommendation->item()->identity(), $this->recommendations)) {
         return;
     }
     unset($this->recommendations[$recommendation->item()->identity()]);
 }
 public function doPostProcess(NodeInterface $input, Recommendation $recommendation, RecordCursorInterface $result)
 {
     if (count($result->records()) === 0 || !$result->getRecord()->hasValues()) {
         return;
     }
     $recommendation->add(new PartialScore(1, $this->name()));
 }
 public function doPostProcess(NodeInterface $input, Recommendation $recommendation, RecordCursorInterface $result)
 {
     if ($result->getRecord()->value('degree') <= 0) {
         return;
     }
     $recommendation->addScore($this->name(), new SingleScore(-($result->getRecord()->value('degree') / 100)));
 }
 public function prepareQuery(NodeInterface $input, Recommendation $recommendation, CypherAwarePostProcessor $postProcessor)
 {
     $query = 'MATCH (input), (reco) WHERE id(input) = {idInput} AND id(reco) = {idReco}' . PHP_EOL;
     $query .= $postProcessor->query();
     $parameters = ['idInput' => $input->identity(), 'idReco' => $recommendation->item()->identity()];
     $tag = sprintf('post_process_%s_%d', $postProcessor->name(), $recommendation->item()->identity());
     $this->stack->push($query, $parameters, $tag);
 }
 public function doPostProcess(NodeInterface $input, Recommendation $recommendation, RecordCursorInterface $result)
 {
     if (count($result->records()) > 0) {
         foreach ($result->records() as $record) {
             $recommendation->addScore(new Score(1, $this->name()));
         }
     }
 }
Exemplo n.º 6
0
 public function postProcess(NodeInterface $input, Recommendation $recommendation, RecordCursorInterface $result = null)
 {
     $record = $result->getRecord();
     if ($rating = $record->value("ratings")) {
         if ($rating > 10) {
             $recommendation->addScore($this->name(), new SingleScore($rating));
         }
     }
 }
Exemplo n.º 7
0
 public function postProcess(NodeInterface $input, Recommendation $recommendation, RecordCursorInterface $result = null)
 {
     if (null === $result) {
         throw new \RuntimeException(sprintf('Expected a non-null result in %s::postProcess()', get_class($this)));
     }
     if (count($result->records()) > 0) {
         foreach ($result->records() as $record) {
             $recommendation->addScore($this->name(), new SingleScore(1));
         }
     }
 }
Exemplo n.º 8
0
 public function postProcess(Node $input, Recommendation $recommendation, Record $record)
 {
     $recommendation->addScore($this->name(), new SingleScore($record->get('score'), 'total_ratings_relationships'));
 }
 public function postProcess(Node $input, Recommendation $recommendation, Record $record)
 {
     $recommendation->addScore($this->name(), new SingleScore(-$record->get('followersCount') / 50));
 }