Ejemplo n.º 1
0
 public function testsimpleAnalyze()
 {
     //TODO benchmark
     for ($i = 0; $i < 1000; $i++) {
         Analyzer::analyze($this->getPseudoRandomWord(), true);
         $it = ++static::$iterations;
         echo "iterated {$it} times...\n";
     }
 }
 private function doNextCase()
 {
     $case = $this->testCases[static::$nextCase++];
     $num = static::$nextCase;
     $label = Analyzer::analyze($case['txt'], true)->label;
     $expected = $case['expected'];
     echo "\n{$num}. got {$label}; expected {$expected}\n";
     $this->assertTrue($label == $case['expected']);
 }
Ejemplo n.º 3
0
 private static function analyzePayload($payload)
 {
     $analyzedPosts = array();
     $decodedPayload = json_decode($payload);
     $posts = $decodedPayload->posts;
     foreach ($posts as $post) {
         $feeling = Analyzer::analyze($post->text);
         $analyzed = (object) array('id' => $post->id, 'feeling' => $feeling, 'tags' => $post->tags);
         $analyzedPosts[] = $analyzed;
     }
     return $analyzedPosts;
 }
Ejemplo n.º 4
0
 public function testAnalyzer()
 {
     $result = Analyzer::analyze("Guns are awesome");
     dd($result);
     return "Testing functions";
 }