本文整理汇总了PHP中Annotation::get_consensus_count方法的典型用法代码示例。如果您正苦于以下问题:PHP Annotation::get_consensus_count方法的具体用法?PHP Annotation::get_consensus_count怎么用?PHP Annotation::get_consensus_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Annotation
的用法示例。
在下文中一共展示了Annotation::get_consensus_count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_feature
protected function get_feature(Annotation $annotation)
{
//if ($annotation->get_id() == 2363)
// test_msg('Language_variable_consensus', array($annotation->get_id(), $annotation->get_consensus_count()));
$feature = $annotation->get_consensus_count();
return $feature;
}
示例2: consensus
public function consensus()
{
$annotation = new Annotation(1017);
$this->unit->run($annotation->get_consensus_count(), 1, 'get_consensus_count');
$this->unit->run($annotation->get_consensus_coll()->get_item(0)->get_id(), 1018, 'get_consensus_coll後get_item get_id');
unit_test_report($this);
}
示例3: array
function scope_consensus()
{
$title = __FUNCTION__;
$this->_display_header($title);
// ---------
$social_function = array(0 => 0, 1 => 68.41493131999999, 2 => 82.31058928, 3 => 89.40518387, 4 => 91.31036774, 5 => 92.55095258999999, 7 => 94.7275144, 8 => 97.06468764, 9 => 1);
/*$sentence_index = array(0,142,199,256,314,402,473,530,663,667,790,932,1035,1193,1255,1340,1419,1444,1463,1503,1564,1636,1664,1689,1716,1742,1871,1921,1989,2019,2108,2217,2295,2422,2557,2718,2791,2916,3032,3079,3146,3197,3213,3226,3239,3266,3313,3411,3604,3640,3854,3922,3980,4068,4082,4201,4285,4387,4497,4500,4526,4590,4653,4679,4727,4764,4796,4803,4812,4820,4829,4836,4845,4858,4893,4903,4913,4961,4969,5017,5044,5052,5120,5148,5156,5210,5279,5307,5316,5333,5384,5433,5529,5563,5595,5674,5718,5789,5854,5920,5955,5985,6027,6055,6090,6165,6238,6432,6520,6535,6553,6608,6639,6796,6836,7042,7046,7086,7104,7144,7246,7284,7292,7328,7361,7419,7427,7485,7564,7572,7607,7637,7724,7732,7821,7903,7969,7988,8065,8074,8166,8198,8233,8276,8368,8396,8549,8618,8648,8684,8743,8823,8857,8891,8920,8997,9025,9107,9118,9139,9153,9178,9187,9189,9199,9208,9211,9218,9247,9267,9275,9280,9283,9286,9290,9292,9299,9306,9313,9319,9334,9337,9350,9355,9358,9362,9370,9382,9385,9392,9401,9404,9408,9415,9421,9427,9439,9448,9451,9455,9462,9468,9495,9499,9505,9508,9511,9515,9529,9536,9557,9561,9568,9575,9582,9588,9598,9612,9615,9684,9736,9900,18,74,76,682,686,695,1266,1509,1748,2570,2805,3331,3422,3663,3737,3766,3774,4091,5226,5241,5324,5339,5443,5798,6180,6258,6289,6308,6319,6353,6654,6846,6893,6929,6970,6974,7158,7159,7166,7171,7207,7827,8280,9111,9617,9688,9711,9746,9762,9796,9816,9851,9873,9909);
sort($sentence_index);
echo '$sentence_index = array(';
foreach ($sentence_index AS $s)
{
echo $s.',';
}
echo ');<br />';
*
*/
$sentence_index = array(0, 18, 74, 76, 142, 199, 256, 314, 402, 473, 530, 663, 667, 682, 686, 695, 790, 932, 1035, 1193, 1255, 1266, 1340, 1419, 1444, 1463, 1503, 1509, 1564, 1636, 1664, 1689, 1716, 1742, 1748, 1871, 1921, 1989, 2019, 2108, 2217, 2295, 2422, 2557, 2570, 2718, 2791, 2805, 2916, 3032, 3079, 3146, 3197, 3213, 3226, 3239, 3266, 3313, 3331, 3411, 3422, 3604, 3640, 3663, 3737, 3766, 3774, 3854, 3922, 3980, 4068, 4082, 4091, 4201, 4285, 4387, 4497, 4500, 4526, 4590, 4653, 4679, 4727, 4764, 4796, 4803, 4812, 4820, 4829, 4836, 4845, 4858, 4893, 4903, 4913, 4961, 4969, 5017, 5044, 5052, 5120, 5148, 5156, 5210, 5226, 5241, 5279, 5307, 5316, 5324, 5333, 5339, 5384, 5433, 5443, 5529, 5563, 5595, 5674, 5718, 5789, 5798, 5854, 5920, 5955, 5985, 6027, 6055, 6090, 6165, 6180, 6238, 6258, 6289, 6308, 6319, 6353, 6432, 6520, 6535, 6553, 6608, 6639, 6654, 6796, 6836, 6846, 6893, 6929, 6970, 6974, 7042, 7046, 7086, 7104, 7144, 7158, 7159, 7166, 7171, 7207, 7246, 7284, 7292, 7328, 7361, 7419, 7427, 7485, 7564, 7572, 7607, 7637, 7724, 7732, 7821, 7827, 7903, 7969, 7988, 8065, 8074, 8166, 8198, 8233, 8276, 8280, 8368, 8396, 8549, 8618, 8648, 8684, 8743, 8823, 8857, 8891, 8920, 8997, 9025, 9107, 9111, 9118, 9139, 9153, 9178, 9187, 9189, 9199, 9208, 9211, 9218, 9247, 9267, 9275, 9280, 9283, 9286, 9290, 9292, 9299, 9306, 9313, 9319, 9334, 9337, 9350, 9355, 9358, 9362, 9370, 9382, 9385, 9392, 9401, 9404, 9408, 9415, 9421, 9427, 9439, 9448, 9451, 9455, 9462, 9468, 9495, 9499, 9505, 9508, 9511, 9515, 9529, 9536, 9557, 9561, 9568, 9575, 9582, 9588, 9598, 9612, 9615, 9617, 9684, 9688, 9711, 9736, 9746, 9762, 9796, 9816, 9851, 9873, 9900, 9909);
$this->load->library('search/Search_annotation_user_collection');
$this->load->library('search/Search_annotation_id_collection');
$query = $this->db->select('"user".user_id, email, annotation.annotation_id, score')->from('annotation
, "user", webpage2annotation, score')->where('annotation.user_id = "user".user_id
AND webpage2annotation.annotation_id = annotation.annotation_id
AND webpage_id = ' . $this->obs_webpage_id . '
AND annotation.topic_id IS NULL
AND annotation.deleted IS FALSE
AND annotation.create_timestamp > \'' . $this->obs_date_from . '\'
AND annotation.create_timestamp < \'' . $this->obs_date_to . '\'
AND score.annotation_id = annotation.annotation_id
AND score.score_type_id = 1')->where('email ' . $this->in_email)->order_by('email')->get();
$consensus_count = array();
$annotation_count = array();
$consensus_max = array();
$consensus_min = array();
$total_count = 0;
$total_annotation_count = 0;
$total_max = 0;
$total_min = NULL;
$freq_count = array();
$freq_total = 0;
$comp_count = array();
$comp_total = 0;
$thead = array('受試者', '閱讀理解分數', '閱讀理解分數高低分組_1低_2高', '標註編號', '標註範圍共識', '專家調查', '加權社群行為', '範圍位置', '以句為單位的共識次數');
$tbody = array();
foreach ($query->result_array() as $row) {
$email = $row['email'];
$annotation_id = intval($row['annotation_id']);
$annotation = new Annotation($annotation_id);
$count = $annotation->get_consensus_count();
/**
* 來計算以句子為單位的共識
* @author Pudding Chen 20121228
*/
//取得標註的位置
$scopes = $annotation->get_scopes();
foreach ($scopes as $scope) {
$from_index = intval($scope->get_from_index());
$to_index = intval($scope->get_to_index());
}
//擴張標註的位置
$sentence_from_index = null;
$sentence_to_index = null;
$last_s_index = 0;
//if ($from_index != 1)
// continue;
foreach ($sentence_index as $s => $s_index) {
//先判斷句子開頭
if (is_null($sentence_from_index)) {
if ($from_index == 0) {
$sentence_from_index = 0;
} else {
if ($from_index < $s_index) {
$sentence_from_index = $last_s_index;
}
}
}
if ($to_index < $s_index) {
//echo $to_index.'-'.$s_index.'!<br />';
//{
//$set_next_s_index = true;
//$sentence_to_index = $last_s_index;
$sentence_to_index = $s_index;
break;
//}
}
//echo '['.$s.":".$from_index.'-'.$to_index.'-'.$s_index.'-'.$last_s_index.'|'.$sentence_from_index.'-'.$sentence_to_index.'?'.($sentence_from_index == null).'-'.($to_index < $s_index).']<br />';
$last_s_index = $s_index;
}
//找完了,範圍是
//$sentense_from_index
//$sentense_to_index
//建立搜尋範圍
$s = new Annotation_scope();
//$s->set_index($sentence_from_index, $sentence_to_index);
$s->set_index($from_index, $to_index);
$s->set_webpage($this->obs_webpage_id);
$sentence_search_scope = new Annotation_scope_collection();
$sentence_search_scope->add_scope($s);
//echo $sentence_search_scope->length().'-'.$this->obs_webpage_id.'|';
$sentence_consensus_count = '--';
//if ($from_index == 1)
//.........这里部分代码省略.........
示例4: _print_annotation_table
/**
* 輸出Annotation的資料
* @param Annotation $annotation
* @return string
*/
private function _print_annotation_table($annotation, &$last_scope)
{
$annotation_id = $annotation->get_id();
$text = '<a name="annotation_' . $annotation_id . '" id="annotation_' . $annotation_id . '"></a><table class="annotation_table" cellspacing="0" cellpadding="0"><tbody>';
$scope_collection = $annotation->get_scopes();
$scope = $scope_collection->get_item(0);
$from_index = $scope->get_from_index();
$to_index = $scope->get_to_index();
if (is_null($last_scope) or !($last_scope[0] == $from_index and $last_scope[1] == $to_index)) {
$last_scope = array($from_index, $to_index);
$scope_length = $annotation->get_scope_length();
$from_to = $from_index;
if ($from_index != $to_index) {
$from_to .= '-' . $to_index;
}
$anchor_text = $annotation->get_anchor_text();
$speech = $annotation->get_anchor_speech();
$speech_list = '';
foreach ($speech as $s) {
if ($speech_list != '') {
$speech_list .= ', ';
}
$speech_list .= $s;
}
if ($speech_list == '') {
$speech_list = '(剖析失敗)';
}
//位置
$location = $annotation->get_feature_location();
$location_list = '';
foreach ($location as $l) {
if ($location_list != '') {
$location_list .= ', ';
}
$name = '其他';
$l = intval($l);
if ($l == 4) {
$name = '結尾';
} else {
if ($l == 0) {
$name = '開頭';
} else {
if ($l == 1) {
$name = '接近開頭';
} else {
if ($l == 3) {
$name = '接近結尾';
} else {
if ($l == 5) {
$name = '只有一句';
} else {
if ($l == 2) {
$name = '三句中間一句';
}
}
}
}
}
}
$location_list .= $name . '(' . $l . ')';
}
if ($location_list == '') {
$location_list = '其他';
}
$text .= '<tr> <td> <table class="anchor_row" border="1" cellpadding="0" cellspacing="0"><tbody>' . '<tr><th>範圍</th><td>' . $from_to . ' (' . $scope_length . '字)</td><th>詞性(' . count($speech) . ')</th><td>' . $speech_list . '</td><th>位置</th><td>' . $location_list . '</td></tr>' . '<tr><th>錨點文字</th><td colspan="5">' . $anchor_text . '</td></tr>' . '</tbody></table> </td> </tr>';
}
//第一列
//
// email 發表日期 修改日期 被喜愛 被共識 被回應 編號
$email = $annotation->get_user()->get_email();
$print_email = substr($email, 0, 8);
$print_email = '<a href="' . site_url('/admin_apps/exp201012annotation/email_list/' . $this->_find_email_key($email)) . '">' . $print_email . '</a>';
//類別
$type_name = $annotation->get_type()->get_name();
$type_name_lang = $this->lang->line('web_apps.' . $type_name);
$type_name_classname = substr($type_name, strrpos($type_name, '.') + 1);
$create_timestamp = $annotation->get_create_timestamp();
//2010-12-08 23:17:10.984+08
//01234567890123456789
$create_timestamp = $this->_trim_timestamp($create_timestamp);
$update_timestamp = $annotation->get_update_timestamp();
$update_timestamp = $this->_trim_timestamp($update_timestamp);
$liked_count = $annotation->get_like_count();
$consensus_count = $annotation->get_consensus_count();
$topic_respond_count = $annotation->get_topic_respond_coll()->length();
$text .= '<tr> <td> <table class="row" border="1" cellpadding="0" cellspacing="0"><tbody><tr>' . '<th class="email">' . $print_email . '</th>' . '<th class="type ' . $type_name_classname . '">' . $type_name_lang . '</th>' . '<th>建立日期:</th><td class="date">' . $create_timestamp . '</td>' . '<th>修改日期:</th><td class="date">' . $update_timestamp . '</td>' . '<td class="annotation_id">#' . $annotation_id . '</td>' . '</tr></tbody></table> </td> </tr>';
//第二列
// 標註類別 位置 分數 建議的ID 推薦的ID 接受建議間隔
//分數
$score = $annotation->get_score(0)->get_score();
//是否有建議?顯示建議的ID
$query = $this->db->select('recommend_id, accept, (checked_timestamp - annotation.create_timestamp) as check_interval, recommend_by_annotation_id')->from('recommend join annotation on recommended_annotation_id = annotation.annotation_id')->where('recommended_annotation_id', $annotation_id)->get();
$recommend_table;
if ($query->num_rows() == 0) {
$recommend_table = '沒有建議';
//.........这里部分代码省略.........