" . $x_value . "
";
for ($i = 0; $i < $iFetch; $i++) {
$mean = $Fetch[$i]["mean"];
$dictid = $Fetch[$i]["dict_id"];
$dict_list[$dictid] = $Fetch[$i]["shortname"];
$dict_list_a[] = array("ref_dict_$dictid", $Fetch[$i]["shortname"]);
echo "" . $x_value['grammar'] . "
";
for ($i = 0; $i < $iFetch; $i++) {
$mean = $Fetch[$i]["mean"];
$dictid = $Fetch[$i]["dict_id"];
$dict_list[$dictid] = $Fetch[$i]["shortname"];
$dict_list_a[] = array("ref_dict_$dictid", $Fetch[$i]["shortname"]);
echo "";
foreach ($dict_list_a as $x_value) {
if (substr($x_value[0], 0, 4) == "word") {
echo "
";
} else {
echo "
";
}
}
echo "
";
$arrWords = countWordInPali($word, true);
$weight = 0;
foreach ($arrWords as $oneword) {
$weight += $oneword["count"] * $oneword["len"];
}
//echo "
{$_local->gui->word_weight}:$weight {$_local->gui->characters}
";
//echo "
{$_local->gui->real_declension}:".count($arrWords)." {$_local->gui->forms}
";
$right_word_list .= "
{$_local->gui->word_weight}:$weight {$_local->gui->characters}
";
$right_word_list .= "
{$_local->gui->real_declension}:" . count($arrWords) . " {$_local->gui->forms}
";
foreach ($arrWords as $oneword) {
if ($oneword["bold"] > 0) {
//echo "
{$oneword["word"]} {$oneword["count"]} {$_local->gui->times}
";
$right_word_list .= "
{$oneword["word"]} {$oneword["count"]} {$_local->gui->times}
";
} else {
//echo "
{$oneword["word"]} {$oneword["count"]}{$_local->gui->times}
";
$right_word_list .= "
{$oneword["word"]} {$oneword["count"]}{$_local->gui->times}
";
}
}
echo "
";
echo "
";
echo "";
//参考字典查询结束
//用户词典编辑窗口
echo "";
echo "
";
echo $right_word_list;
/*
echo "
{$_local->gui->undone_function}";
echo "
{$_local->gui->edit}
";
echo "
{$word}
";
if ($iFetch > 0) {
echo "
";
} else {
echo "
";
echo "
";
*/
echo "
";
//查用户词典结束
function lookup_user($word){
global $dict_list;
global $redis;
global $_local;
global $PDO;
global $count_return;
$output ="";
$Fetch=array();
if($redis){
$wordData = $redis->hGet("dict://user",$word);
if($wordData){
if(!empty($wordData)){
$arrWord = json_decode($wordData,true);
foreach ($arrWord as $one) {
# code...
$Fetch[] = array("id"=>$one[0],
"pali"=>$one[1],
"type"=>$one[2],
"gramma"=>$one[3],
"parent"=>$one[4],
"mean"=>$one[5],
"note"=>$one[6],
"factors"=>$one[7],
"factormean"=>$one[8],
"status"=>$one[9],
"confidence"=>$one[10],
"creator"=>$one[11],
"dict_name"=>$one[12],
"lang"=>$one[13],
);
}
}
}
else{
# 没找到就不找了
}
}
else{
PDO_Connect("" . _FILE_DB_WBW_);
$query = "SELECT * from " . _TABLE_DICT_REF_ . " where pali = ? limit 0,100";
$Fetch = PDO_FetchAll($query, array($word));
}
$iFetch = count($Fetch);
if ($iFetch > 0) {
$count_return++;
$userlist = array();
foreach ($Fetch as $value) {
if (isset($userlist[$value["creator"]])) {
$userlist[$value["creator"]] += 1;
} else {
$userlist[$value["creator"]] = 1;
}
$userwordcase = $value["type"] . "#" . $value["gramma"];
$parent = $value["parent"];
if(empty($parent)){
$parent = "_null_";
}
if (isset($userdict["{$parent}"])) {
$userdict["{$parent}"]["mean"] .= "$". $value["mean"] ;
$userdict["{$parent}"]["factors"] .= "@". $value["factors"];
$userdict["{$parent}"]["case"] .= "@".$userwordcase;
} else {
$userdict["{$parent}"]["mean"] = $value["mean"];
$userdict["{$parent}"]["factors"] = $value["factors"];
$userdict["{$parent}"]["case"] = $userwordcase;
}
}
$output .= "
";
$output .= "
{$_local->gui->com_dict}
";
$dict_list_a[] = array("net", $_local->gui->com_dict);
foreach ($userdict as $key => $value) {
#语法信息查重
$thiscase = array();
$strCase = "";
$arrCase = explode("@",$value["case"]);
foreach ($arrCase as $case) {
# code...
$thiscase[$case] = 1;
}
foreach ($thiscase as $case => $casevalue) {
# code...
$strCase .=$case . "; ";
}
#语法信息替换为本地字符串
foreach ($_local->grammastr as $gr) {
$strCase = str_replace($gr->id, $gr->value, $strCase);
}
#拆分查重复
$thispart = array();
$strPart = "";
$arrPart = explode("@",$value["factors"]);
foreach ($arrPart as $part) {
# code...
$thispart[$part] = 1;
}
foreach ($thispart as $part => $partvalue) {
# code...
$strPart .=$part . "; ";
}
#意思查重复
$thismean = array();
$strMean = "";
$arrMean = explode("$",$value["mean"]);
foreach ($arrMean as $mean) {
# code...
$thismean[$mean] = 1;
}
foreach ($thismean as $mean => $meanvalue) {
# code...
$strMean .=$mean . "; ";
}
$output .= "
语法:{$strCase}
";
if($key!=="_null_"){
$output .= "
";
}
$output .= "
意思:{$strMean}
";
$output .= "
组成:{$strPart}
";
}
$output .= "
{$_local->gui->contributor}:";
$userinfo = new UserInfo();
foreach ($userlist as $key => $value) {
$user = $userinfo->getName($key);
$output .= $user["nickname"] . " ";
}
$output .= "
";
$output .= "
";
}
return $output;
}
function lookup_term($word){
global $dict_list;
global $redis;
global $_local;
global $PDO;
global $count_return;
$output ="";
$Fetch=array();
if($redis){
$wordData = $redis->hGet("dict://term",$word);
if($wordData){
if(!empty($wordData)){
$arrWord = json_decode($wordData,true);
foreach ($arrWord as $one) {
# code...
$Fetch[] = array("id"=>$one[0],
"pali"=>$one[1],
"type"=>$one[2],
"gramma"=>$one[3],
"parent"=>$one[4],
"mean"=>$one[5],
"note"=>$one[6],
"factors"=>$one[7],
"factormean"=>$one[8],
"status"=>$one[9],
"confidence"=>$one[10],
"creator"=>$one[11],
"dict_name"=>$one[12],
"lang"=>$one[13],
);
}
}
}
else{
# 没找到就不找了
}
}
else{
PDO_Connect("" . _FILE_DB_WBW_);
$query = "SELECT * from " . _TABLE_DICT_REF_ . " where pali = ? limit 0,100";
$Fetch = PDO_FetchAll($query, array($word));
}
$iFetch = count($Fetch);
$count_return += $iFetch;
if ($iFetch > 0) {
$userlist = array();
foreach ($Fetch as $value) {
if (isset($userlist[$value["creator"]])) {
$userlist[$value["creator"]] += 1;
} else {
$userlist[$value["creator"]] = 1;
}
$userwordcase = $value["type"] . "#" . $value["gramma"];
if (isset($userdict["{$userwordcase}"])) {
$userdict["{$userwordcase}"]["mean"] .= $value["mean"] . ";";
$userdict["{$userwordcase}"]["factors"] .= $value["factors"];
} else {
$userdict["{$userwordcase}"]["mean"] = $value["mean"];
$userdict["{$userwordcase}"]["factors"] = $value["factors"];
}
}
$output .= "
";
$output .= "
{$_local->gui->wiki_term}
";
$dict_list_a[] = array("net", $_local->gui->wiki_term);
foreach ($userdict as $key => $value) {
$output .= "
{$key}:{$value["mean"]}
";
}
$output .= "
{$_local->gui->contributor}:";
$userinfo = new UserInfo();
foreach ($userlist as $key => $value) {
$user = $userinfo->getName($key);
$output .= $user["nickname"] . " ";
}
$output .= "
";
$output .= "
";
}
return $output;
}