Jelajahi Sumber

自动拆分词头改为hash

visuddhinanda 5 tahun lalu
induk
melakukan
dce9297a86

+ 15 - 17
app/dict/comp_csv.php

@@ -8,7 +8,7 @@ if (isset($argv[1])) {
 	$start = (int)$argv[1];
 }
 else{
-	$start=0;
+	$start=1;
 }
 
 if (isset($argv[2])) {
@@ -38,28 +38,25 @@ if ($redis == false) {
     exit;
 }
 $i = null;
-$counter = 0;
-while ($words = $redis->sscan("pali_word", $i)) {
+
+while($word = $redis->hGet("pali://wordindex.hash",$start))
+{
 	# code...
-	
-	if($counter<$start){
-		$counter+=10;
-		continue;
-	}
-	if($counter>$end){
+
+	if($start>$end){
 		echo "all done";
 		exit;
 	}
-    foreach ($words as $key => $word) {
+
+	{
         # code...
         $arrword = split_diphthong($word);
         if (count($arrword) > 1) {
-			$data = array($counter,$word,'.comp.','','','','',implode("+", $arrword),'',1,50,6,'comp','en');
+			$data = array($start,$word,'.comp.','','','','',implode("+", $arrword),'',1,50,6,'comp','en');
             fputcsv($myfile, $data);
         }
 
         foreach ($arrword as $oneword) {
-            $counter++;
 			$result = array(); //全局变量,递归程序的输出容器
 			mySplit2($oneword, 0, true, 0.5, 0.9, 0, true, false);
 			mySplit2($oneword, 0, true, 0.5, 0.9, 0, false, false);
@@ -84,23 +81,23 @@ while ($words = $redis->sscan("pali_word", $i)) {
             mySplit2($oneword, 0, false, 0, 0.8, 0.8, true);
             }
              */
-            echo "{$counter}-{$oneword}:" . count($result) . "\n";
+            echo "{$start}-{$oneword}:" . count($result) . "\n";
             if (count($result) > 0) {
                 arsort($result); //按信心指数排序
                 $iCount = 0;
                 foreach ($result as $row => $value) {
-					$data = array($counter,$oneword,'.comp.','','','','',$row,'',1,round($value*70),6,'comp','en');
+					$data = array($start,$oneword,'.comp.','','','','',$row,'',1,round($value*70),6,'comp','en');
 					fputcsv($myfile, $data);
 
 								//后处理 进一步切分没有意思的长词
 					$new = split2($row);
 					if($new!==$row){
-						$data = array($counter,$oneword,'.comp.','','','','',$new,'',1,round($value*70),6,'comp','en');
+						$data = array($start,$oneword,'.comp.','','','','',$new,'',1,round($value*70),6,'comp','en');
 						fputcsv($myfile, $data);
 						#再处理一次
 						$new2 = split2($new);
 						if($new2!==$new){
-							$data = array($counter,$oneword,'.comp.','','','','',$new2,'',1,round($value*70),6,'comp','en');
+							$data = array($start,$oneword,'.comp.','','','','',$new2,'',1,round($value*70),6,'comp','en');
 							fputcsv($myfile, $data);				
 						}				
 					}
@@ -115,5 +112,6 @@ while ($words = $redis->sscan("pali_word", $i)) {
 
         }
 
-    }
+	}
+	$start++;
 }

+ 293 - 3
app/dict/css/style.css

@@ -1,3 +1,290 @@
+body {
+	margin: unset;
+}
+
+.index_toolbar {
+	position: unset;
+}
+
+.search_toolbar {
+	height: initial;
+	padding: 0.6em 1em 0.1em 1em;
+	background-color: var(--tool-bg-color1);
+	border-bottom: none;
+}
+
+.search_fixed {
+	position: fixed;
+	top: -500px;
+	width: 100%;
+	display: flex;
+	padding: 0.5em 1em;
+}
+
+#dict_search_result {
+	display: flex;
+}
+
+#dict_list {
+	flex: 2;
+	text-align: right;
+	padding-right: 1em;
+	border-right: 1px solid var(--border-line-color);
+}
+
+#dict_ref {
+	flex: 6;
+	padding: 0.5em 1.5em;
+}
+
+#dict_user {
+	flex: 2;
+}
+
+.dict_word_card {
+	border-bottom: 1px solid var(--border-line-color);
+	padding: 5px 0;
+	display: block;
+	border-radius: unset;
+	margin: 10px 0;
+	transition: unset;
+	box-shadow: unset;
+}
+
+.dict_word {
+	border-left: none;
+	border-right: none;
+	border-top: none;
+	border-bottom: 1px solid var(--border-line-color);
+	padding: 5px 0;
+	display: block;
+	border-radius: unset;
+	margin: 10px 0;
+	transition: unset;
+	box-shadow: unset;
+}
+
+.dict_word > .dict {
+	font-size: 110%;
+	color: var(--link-hover-color);
+	border-bottom: unset;
+	padding-bottom: 10px;
+}
+
+.dict_word > .mean {
+	font-size: unset;
+	margin: 2px 0;
+	line-height: 150%;
+	font-weight: unset;
+	display: block;
+}
+
+/*for word split part */
+.dropdown_ctl {
+	display: inline-block;
+	margin: 0 0.7em;
+}
+
+.dropdown_ctl > .content {
+	display: flex;
+	border: 1px solid var(--border-line-color);
+	border-radius: 99px;
+	line-height: 2em;
+}
+
+.dropdown_ctl > .menu {
+	position: absolute;
+	box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
+	display: none;
+}
+
+.dropdown_ctl > .menu {
+	background-color: white;
+}
+
+.dropdown_ctl > .content > .main_view > part {
+	margin: 0 0.5em;
+	color: cornflowerblue;
+	cursor: pointer;
+}
+
+.dropdown_ctl > .menu > .part_list {
+	padding: 5px;
+	cursor: pointer;
+}
+
+.dropdown_ctl > .menu > .part_list:hover {
+	background-color: azure;
+}
+
+.dropdown_ctl > .content > .more_button {
+	background-color: var(--btn-color);
+	min-width: 1.4em;
+	text-align: center;
+	border-radius: 99px;
+	cursor: pointer;
+}
+
+.pre_serach_block {
+	border-bottom: 1px solid var(--shadow-color);
+	padding: 5px 0;
+}
+
+.pre_serach_block_title {
+	display: flex;
+	justify-content: space-between;
+}
+
+.pre_serach_content {
+}
+
+#footer_nav {
+	display: none;
+}
+
+.right_tool_btn {
+	position: fixed;
+	right: 50px;
+	top: 5em;
+	background-color: unset;
+}
+
+.right_tool_btn .icon {
+	height: 2em;
+	width: 2em;
+}
+
+.right_tool_btn button:hover {
+	background-color: var(--link-hover-color);
+	border-color: var(--link-color);
+	color: var(--btn-hover-color);
+	height: 3em;
+	width: 3em;
+	padding: 0;
+}
+
+.right_tool_btn button {
+	background-color: var(--link-color);
+	border-color: var(--link-color);
+	color: var(--btn-color);
+	height: 3em;
+	width: 3em;
+	padding: 0;
+}
+
+button,
+input[type="button"],
+input[type="submit"] {
+	font-weight: 500;
+	font-size: 90%;
+	background-color: none;
+	border: 2px solid var(--btn-border-color);
+	border-radius: 99px;
+	margin: 2px;
+	padding: 2px 12px;
+	-webkit-transition-duration: 0.2s;
+	-moz-transition-duration: 0.2s;
+	transition-duration: 0.2s;
+	cursor: pointer;
+	display: -webkit-inline-flex;
+	display: -moz-inline-flex;
+	display: inline-flex;
+	-webkit-align-items: center;
+	-moz-align-items: center;
+	align-items: center;
+	-webkit-flex-wrap: nowrap;
+	-moz-flex-wrap: nowrap;
+	flex-wrap: nowrap;
+	-webkit-justify-content: center;
+	-moz-justify-content: center;
+	justify-content: center;
+}
+
+.dict_find_gramma guide {
+	color: unset;
+}
+
+#pre_search_result {
+	background-color: var(--bg-color);
+	z-index: 50;
+	display: none;
+}
+
+#dt_title {
+	border-bottom: 2px solid var(--link-hover-color);
+}
+
+.dict_word_list .mean {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	display: -webkit-box;
+	-webkit-box-orient: vertical;
+	-webkit-line-clamp: 1;
+	padding-left: 1em;
+	color: var(--main-color1);
+}
+.dict_word_list {
+	padding: 2px 10px 5px 10px;
+}
+.dict_word_list:hover {
+	background-color: var(--link-color);
+	color: var(--btn-hover-color);
+}
+.section_inner {
+	max-width: 1024px;
+	margin: 0 auto;
+}
+.spell {
+	font-size: 100%;
+	font-weight: 500;
+}
+
+.pali_spell {
+	font-size: 200%;
+	font-weight: 700;
+	margin-top: 15px;
+	padding-bottom: 0;
+}
+#main_view {
+	display: flex;
+}
+#main_result {
+	flex: 7;
+}
+#right_bar {
+	flex: 3;
+}
+.auto_mean {
+	display: flex;
+}
+.auto_mean > .spell {
+	font-weight: 700;
+	margin-right: 1em;
+}
+.auto_mean > .meaning {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	display: -webkit-box;
+	-webkit-box-orient: vertical;
+	-webkit-line-clamp: 2;
+	color: var(--main-color1);
+}
+#word_parts {
+}
+#search_info {
+	display: flex;
+	justify-content: space-between;
+}
+#part_mean {
+	margin: 1em;
+	padding: 1em;
+	border: 1px solid var(--border-line-color);
+	background-color: var(--bg-color);
+	box-shadow: 0 5px 7px rgb(0 0 0 / 5%);
+}
+#part_mean_shell {
+	display: none;
+}
 #dict_ref_search_result {
 	margin: 4em 5px 5px 1em;
 	width: 100%;
@@ -13,10 +300,10 @@
 }
 
 .dict_word .mean {
-	font-size: 90%;
+	font-size: 100%;
 	margin: 2px 0;
-	line-height: 130%;
-	font-weight: 300;
+	line-height: 160%;
+	font-weight: 400;
 	display: inline-block;
 	font-style: normal;
 }
@@ -45,3 +332,6 @@ textarea {
 	height: fit-content;
 	font-size: 1.2em;
 }
+#search_result_shell {
+	padding: 2px 15px;
+}

+ 23 - 8
app/dict/dict.js

@@ -39,10 +39,13 @@ function dict_search(word, autoSplit = true) {
 			$("#search_result_shell").append($("#search_summary"));
 
 			guide_init();
-			get_comp_data(word);
+			if (_autoSplit == true) {
+				get_comp_data(word);
+			}
+
 			let word_count = parseInt($("#word_count").val());
 
-			if (_autoSplit == true && word_count < 3) {
+			if (_autoSplit == true && word_count < 6) {
 				//trubo_split();
 			}
 		}
@@ -196,18 +199,22 @@ function get_comp_data(word) {
 			$("#pre_search_result").hide();
 			try {
 				let result = JSON.parse(data);
-				render_parts_select(result);
+				if (result.length > 0) {
+					render_parts_select(result);
+				} else {
+					trubo_split();
+				}
 			} catch (e) {
 				console.error(e.message);
 			}
 		}
 	);
 }
-
+var gCurrWordParts = "";
 function render_parts_select(part_list) {
 	let html = "<div>";
 	let firstWord = new Array();
-	if (part_list.length > 0) {
+	if (part_list.length > 0 && part_list[0].length > 0) {
 		html += "拆分";
 		let level1Count = 0;
 		for (const part of part_list) {
@@ -232,11 +239,14 @@ function render_parts_select(part_list) {
 			level1Count++;
 		}
 	} else {
-		html += "无法拆分";
+		html += "<button class='part_list' onclick=\"trubo_split()\">深度拆分</button>";
 	}
+	html += "<button onclick='copy_parts()'>copy</button>";
 	html += "</div>";
+
 	$("#input_parts").html(html);
-	getPartMeaning(firstWord.join("+"));
+	gCurrWordParts = firstWord.join("+");
+	getPartMeaning(gCurrWordParts);
 
 	$(".more_button").click(function () {
 		$(this).parent().siblings(".menu").toggle();
@@ -246,6 +256,7 @@ function render_parts_select(part_list) {
 		let html = "<part>" + $(this).text().replace(/\+/g, "</part><part>") + "</part>";
 		$(this).parent().parent().find(".main_view").html(html);
 		$(this).parent().hide();
+		gCurrWordParts = $(this).text();
 		getPartMeaning($(this).text());
 		$("part").click(function () {
 			dict_search($(this).text(), false);
@@ -256,8 +267,12 @@ function render_parts_select(part_list) {
 		dict_search($(this).text(), false);
 	});
 }
+
+function copy_parts() {
+	copy_to_clipboard(gCurrWordParts);
+}
 function trubo_split() {
-	let strSpliting = "正在自动切分复合词……";
+	let strSpliting = "正在自动切分……";
 	if ($("#input_parts").html() == strSpliting) {
 		return;
 	}

+ 3 - 2
app/dict/dict_lookup.php

@@ -220,7 +220,8 @@ $right_word_list = "";
 		echo "</div>";
 		echo "<input type='hidden' id='word_count' value='{$count_return}' />";
 
-        //查连读词
+		//查连读词
+		/*
         if ($count_return < 2) {
             echo "<div>Junction</div>";
             $newWord = array();
@@ -237,7 +238,7 @@ $right_word_list = "";
                 }
             }
 		}
-		
+		*/
 		//拆复合词
 		echo "<div id='auto_split'></div>";
 

+ 4 - 4
app/dict/get_split_data.php

@@ -16,8 +16,8 @@ $redis = redis_connect();
 
 if($redis!==false){
 	#如果没有查巴缅替换拆分
-	if($redis->hExists("dict_comp",$inputWord)===TRUE){
-		$output = $redis->hGet("dict_comp",$inputWord) ;
+	if($redis->hExists("dict://comp",$inputWord)===TRUE){
+		$output = $redis->hGet("dict://comp",$inputWord) ;
 		echo $output;
 		exit;
 	}
@@ -25,12 +25,12 @@ if($redis!==false){
 $dbh = new PDO(_DICT_DB_COMP_, "", "", array(PDO::ATTR_PERSISTENT => true));
 $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 $query = "SELECT parts from "._TABLE_DICT_COMP_." where pali =?";
-$stmt = $PDO->prepare($query);
+$stmt = $dbh->prepare($query);
 $stmt->execute(array($inputWord));
 $fComp = $stmt->fetchAll(PDO::FETCH_ASSOC);		
 $output = json_encode($fComp, JSON_UNESCAPED_UNICODE);
 if($redis!==false){
-	$output = $redis->hSet("dict_comp",$inputWord,$output) ;
+	$redis->hSet("dict://comp",$inputWord,$output) ;
 }
 echo $output;
 

+ 7 - 293
app/dict/index.php

@@ -10,299 +10,7 @@ if (!(isset($_GET["builtin"]) && $_GET["builtin"] == 'true')) {
 }
 ?>
 	<script language="javascript" src="./dict.js"></script>
-	<style>
-		body {
-			margin: unset;
-		}
 
-		.index_toolbar {
-			position: unset;
-		}
-
-		.search_toolbar {
-			height: initial;
-			padding: 0.6em 1em 0.1em 1em;
-			background-color: var(--tool-bg-color1);
-			border-bottom: none;
-		}
-
-		.search_fixed {
-			position: fixed;
-			top: -500px;
-			width: 100%;
-			display: flex;
-			padding: 0.5em 1em;
-		}
-
-		#dict_search_result {
-			display: flex;
-		}
-
-		#dict_list {
-			flex: 2;
-			text-align: right;
-			padding-right: 1em;
-			border-right: 1px solid var(--border-line-color);
-		}
-
-		#dict_ref {
-			flex: 6;
-			padding: 0.5em 1.5em;
-		}
-
-		#dict_user {
-			flex: 2;
-		}
-
-		.dict_word_card {
-			border-bottom: 1px solid var(--border-line-color);
-			padding: 5px 0;
-			display: block;
-			border-radius: unset;
-			margin: 10px 0;
-			transition: unset;
-			box-shadow: unset;
-		}
-
-		.dict_word {
-			border-left: none;
-			border-right: none;
-			border-top: none;
-			border-bottom: 1px solid var(--border-line-color);
-			padding: 5px 0;
-			display: block;
-			border-radius: unset;
-			margin: 10px 0;
-			transition: unset;
-			box-shadow: unset;
-		}
-
-		.dict_word>.dict {
-			font-size: 110%;
-			color: var(--main-color);
-			border-bottom: unset;
-			padding-bottom: 10px;
-		}
-
-		.dict_word>.mean {
-			font-size: unset;
-			margin: 2px 0;
-			line-height: 150%;
-			font-weight: unset;
-			display: block;
-		}
-
-		/*for word split part */
-		.dropdown_ctl {
-			display: inline-block;
-			margin: 0 0.7em;
-		}
-
-		.dropdown_ctl>.content {
-			display: flex;
-			border: 1px solid var(--border-line-color);
-			border-radius: 99px;
-			line-height: 2em;
-		}
-
-		.dropdown_ctl>.menu {
-			position: absolute;
-			box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
-			display: none;
-		}
-
-		.dropdown_ctl>.menu {
-			background-color: white;
-		}
-
-		.dropdown_ctl>.content>.main_view>part {
-			margin: 0 0.5em;
-			color: cornflowerblue;
-			cursor: pointer;
-		}
-
-		.dropdown_ctl>.menu>.part_list {
-			padding: 5px;
-			cursor: pointer;
-		}
-
-		.dropdown_ctl>.menu>.part_list:hover {
-			background-color: azure;
-		}
-
-		.dropdown_ctl>.content>.more_button {
-			background-color: var(--btn-color);
-			min-width: 1.4em;
-			text-align: center;
-			border-radius: 99px;
-			cursor: pointer;
-		}
-
-
-		.pre_serach_block {
-			border-bottom: 1px solid var(--shadow-color);
-			padding: 5px 0;
-		}
-
-		.pre_serach_block_title {
-			display: flex;
-			justify-content: space-between;
-		}
-
-		.pre_serach_content {
-
-		}
-
-		#footer_nav {
-			display: none;
-		}
-
-		.right_tool_btn {
-			position: fixed;
-			right: 50px;
-			top: 5em;
-			background-color: unset;
-		}
-
-		.right_tool_btn .icon {
-			height: 2em;
-			width: 2em;
-		}
-
-		.right_tool_btn button:hover {
-			background-color: var(--link-hover-color);
-			border-color: var(--link-color);
-			color: var(--btn-hover-color);
-			height: 3em;
-			width: 3em;
-			padding: 0;
-		}
-
-		.right_tool_btn button {
-			background-color: var(--link-color);
-			border-color: var(--link-color);
-			color: var(--btn-color);
-			height: 3em;
-			width: 3em;
-			padding: 0;
-		}
-
-		button,
-		input[type="button"],
-		input[type="submit"] {
-			font-weight: 500;
-			font-size: 90%;
-			background-color: none;
-			border: 2px solid var(--btn-border-color);
-			border-radius: 99px;
-			margin: 2px;
-			padding: 2px 12px;
-			-webkit-transition-duration: 0.2s;
-			-moz-transition-duration: 0.2s;
-			transition-duration: 0.2s;
-			cursor: pointer;
-			display: -webkit-inline-flex;
-			display: -moz-inline-flex;
-			display: inline-flex;
-			-webkit-align-items: center;
-			-moz-align-items: center;
-			align-items: center;
-			-webkit-flex-wrap: nowrap;
-			-moz-flex-wrap: nowrap;
-			flex-wrap: nowrap;
-			-webkit-justify-content: center;
-			-moz-justify-content: center;
-			justify-content: center;
-		}
-
-		.dict_find_gramma guide{
-			color:unset;
-		}
-
-		#pre_search_result{
-			background-color: var(--bg-color);
-			z-index: 50;
-			display:none;
-		}
-
-		#dt_title {
-			border-bottom: 2px solid var(--link-hover-color);
-		}
-
-		.dict_word_list .mean {
-			overflow: hidden;
-			text-overflow: ellipsis;
-			display: -webkit-box;
-			-webkit-box-orient: vertical;
-			-webkit-line-clamp: 1;
-			padding-left: 1em;
-			color: var(--main-color1);
-		}
-		.dict_word_list{
-			padding: 2px 10px 5px 10px;
-		}
-		.dict_word_list:hover{
-			background-color: var(--link-color);
-			color: var(--btn-hover-color);
-		}
-		.section_inner{
-			max-width:1024px;
-			margin: 0 auto;
-		}
-		.spell{
-			font-size: 100%;
-    		font-weight: 500;
-		}
-
-
-		.pali_spell{
-			font-size:200%;
-			font-weight:700;
-			margin-top:15px;
-			padding-bottom:0
-		}
-		#main_view{
-			display:flex;
-		}
-		#main_result{
-			flex:7;
-		}
-		#right_bar{
-			flex:3;
-		}
-		.auto_mean{
-			display:flex;
-		}
-		.auto_mean>.spell{
-			font-weight: 700;
-			margin-right: 1em;
-		}
-		.auto_mean>.meaning{
-			overflow: hidden;
-			text-overflow: ellipsis;
-			display: -webkit-box;
-			-webkit-box-orient: vertical;
-			-webkit-line-clamp: 2;
-			color: var(--main-color1);
-		}
-		#word_parts{
-
-		}
-		#search_info{
-			display:flex;
-			justify-content: space-between;
-		}
-		#part_mean{
-			margin: 1em;
-			padding: 1em;
-			border: 1px solid var(--border-line-color);
-			background-color: var(--bg-color);
-			box-shadow: 0 5px 7px rgb(0 0 0 / 5%);
-		}
-		#part_mean_shell{
-			display:none;
-		}
-	</style>
 	<link type="text/css" rel="stylesheet" href="./css/style.css" >
 	<link type="text/css" rel="stylesheet" href="./css/style_mobile.css" media="screen and (max-width:800px)">
 
@@ -334,7 +42,9 @@ if (!(isset($_GET["builtin"]) && $_GET["builtin"] == 'true')) {
 				<div id="pre_search_result" >
 					<div id="pre_search_word" class="pre_serach_block">
 						<div id="pre_search_word_title" class="pre_serach_block_title">
-							<div id="pre_search_word_title_left"><?php echo $_local->gui->vocabulary_list; ?></div>
+							<div id="pre_search_word_title_left">
+							<?php #echo $_local->gui->vocabulary_list; ?>
+							</div>
 							<div id="pre_search_word_title_right"></div>
 						</div>
 						<div id="pre_search_word_content" class="pre_serach_content">
@@ -343,10 +53,12 @@ if (!(isset($_GET["builtin"]) && $_GET["builtin"] == 'true')) {
 				</div>
 			</div>
 			<span style="display:flex;">
+			<!--
 				<button id="trubo_split" onclick="trubo_split()" >
 					<?php echo $_local->gui->turbo_split; /*强力拆分*/ ?>
 				</button>
 				<guide gid="comp_split"></guide>
+				-->
 			</span>
 			<div></div>
 		</div>
@@ -457,6 +169,8 @@ function GetPageScroll() {
 	pos.y = y;
 	return (pos);
 }
+
+ntf_init(1);
 </script>
 
 	<?php

+ 3 - 2
app/dict/redis_comp_part.php

@@ -1,4 +1,5 @@
 <?php
+#从自动复合词数据库中提取数据到ridis
 require_once "../path.php";
 require_once "../redis/function.php";
 
@@ -16,10 +17,10 @@ if (PHP_SAPI == "cli") {
 			$stmtOne->execute(array($row["pali"]));
 			$fComp = $stmtOne->fetchAll(PDO::FETCH_ASSOC);		
 			$output = json_encode(array($fComp), JSON_UNESCAPED_UNICODE);
-			$redis->hSet("dict_comp",$row["pali"],$output);
+			$redis->hSet("dict://comp",$row["pali"],$output);
 		}
 	}
-	echo "all done".$redis->hLen("dict_comp");
+	echo "all done".$redis->hLen("dict://comp");
 }
 
 ?>

+ 21 - 6
app/dict/redis_pali_word_list.php

@@ -11,11 +11,12 @@ if (PHP_SAPI == "cli") {
         if ($redis == false) {
             echo "no redis connect\n";
             exit;
-        }
+		}
+		/*
         $dirXmlBase = _DIR_PALI_CSV_ . "/";
 
         $book = array(1, 2, 3, 4, 5, 6, 7, 8, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 153, 152, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217);
-        $redis->delete('pali_word');
+        $redis->delete('pali://wordindex.set');
         foreach ($book as $key => $value) {
             # code...
             echo "runing:{$value}\n";
@@ -29,15 +30,29 @@ if (PHP_SAPI == "cli") {
                     $irow++;
                     if ($irow > 1) {
                         if ($data[6] != ".ctl." && $data[5] != "") {
-                            $redis->sadd('pali_word', $data[5]);
+                            $redis->sadd('pali://wordindex.set', $data[5]);
                         }
                     }
                 }
-                fclose($fp);
+				fclose($fp);
             } else {
                 echo "can not open csv file. filename=" . $dirXmlBase . $dirXml . $outputFileNameHead . ".csv";
-            }
-        }
+			}
+
+		}
+		echo "set done".$redis->scard("pali://wordindex.set")."\n";
+*/
+		$redis->delete('pali://wordindex.hash');
+		$i = null;
+		$counter = 0;
+		while ($words = $redis->sscan("pali://wordindex.set", $i)) {
+			foreach ($words as $key => $value) {
+				# code...
+				$counter++;
+				$redis->hSet("pali://wordindex.hash",$counter,$value);
+			}
+		}
+		echo "hash done".$redis->hLen("pali://wordindex.hash")."\n";
     }
 } else {
     echo "cli";

+ 3 - 3
app/dict/split.php

@@ -84,15 +84,15 @@ foreach ($arrWords as $currword) {
 		$result = array(); //全局变量,递归程序的输出容器
 		//$noSandhi = removeSandhi($oneword);
 
-        mySplit2($oneword, 0, false, 0, 0.2, 0.1, true, false);
+        mySplit2($oneword, 0, false, 0, 0.2, 0.9, true, false);
 		if(count($result) < 2){
-			//mySplit2($oneword, 0, $_express, 0, 0.2, 0.8, true, true);
+			mySplit2($oneword, 0, $_express, 0, 0.2, 0.8, true, true);
 		}
         if (isset($_POST["debug"])) {
             echo "正切:" . count($result) . "<br>\n";
 		}
 		if(count($result) < 2){
-			//mySplit2($oneword, 0, $_express, 0, 0.2, 0.8, false, true);
+			mySplit2($oneword, 0, $_express, 0, 0.2, 0.8, false, true);
 		}
         if (isset($_POST["debug"])) {
             echo "反切:" . count($result) . "<br>\n";