public function getVectorsreldir() { //FactSpan foreach (\Workerunit::where('type', 'RelDir')->get() as $ann) { if (!isset($ann->content)) { dd($ann); } $ans = $ann->content['Q1']; if (!isset($ans)) { dd($ann); } $dic = array("{{terms_first_text}} {{relation_noPrefix}} {{terms_second_text}}" => $ans == 'Choice1' ? 1 : 0, "{{terms_second_text}} {{relation_noPrefix}} {{terms_first_text}}" => $ans == 'Choice2' ? 1 : 0, "no_relation" => $ans == 'Choice3' ? 1 : 0); $ann->annotationVector = $dic; $ann->update(); } }
public function getTest($entity, $format, $domain, $docType, $incr) { $id = "{$entity}/{$format}/{$domain}/{$docType}/{$incr}"; $unit = MongoDB\Entity::id($id)->first(); echo "<h1>{$unit->_id}</h1>\n"; echo "-Sentence:{$unit->content['sentence']['formatted']}<br>\n"; echo "-Term1:{$unit->content['terms']['first']['formatted']}<br>\n"; echo "-Term2:{$unit->content['terms']['second']['formatted']}<br>\n"; echo "<hr>\r\n"; foreach (Workerunit::where('unit_id', $unit->_id)->where('softwareAgent_id', 'amt')->get() as $ann) { $dic = $ann->createAnnotationVector(); echo "<table>"; foreach ($ann->content as $key => $value) { echo "<tr><td><b>{$key}</b></td><td>{$value}</td></tr>\r\n"; } echo "</table>"; echo "\r\nTERM1\r\n"; echo "<table>"; foreach ($dic['term1'] as $key => $value) { echo "<tr><td><b>{$key}</b></td><td>{$value}</td></tr>\r\n"; } echo "</table>"; echo "\r\nTERM2\r\n"; echo "<table>"; foreach ($dic['term2'] as $key => $value) { echo "<tr><td><b>{$key}</b></td><td>{$value}</td></tr>\r\n"; } echo "</table>"; echo "\r\n<hr>\r\n"; } }