# HG changeset patch # User Zoe Hong # Date 1422373230 -3600 # Node ID 883ad980a43b3426d844e532e6100733e326600c # Parent f196939ccc03b642570c3b36bc8de1ee5d6f168f add dynasty column to table books diff -r f196939ccc03 -r 883ad980a43b .DS_Store Binary file .DS_Store has changed diff -r f196939ccc03 -r 883ad980a43b _xampp/.DS_Store Binary file _xampp/.DS_Store has changed diff -r f196939ccc03 -r 883ad980a43b interface/.DS_Store Binary file interface/.DS_Store has changed diff -r f196939ccc03 -r 883ad980a43b interface/add_dynasty.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/add_dynasty.php Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,99 @@ +"; + if ($row['start_year'] > ($start_year-10) && $row['start_year'] < ($end_year+10)) { + // write $dynasty into record + $query="UPDATE books SET dynasty='".$dynasty."' WHERE id='".$row['id']."'"; + $res=mysql_query($query); + if(!$res){ + echo json_encode("Failed during querying records."); + return; + } + } + + } + echo "----------".$matched_period." books number: ".mysql_num_rows($result)."
"; + } + + fclose($myfile); + +} + + + +$dynasty = array("漢",-140,200); +add_dynasty($dynasty); +$dynasty = array("三國",220,280); +add_dynasty($dynasty); +$dynasty = array("晉",265,420); +add_dynasty($dynasty); +$dynasty = array("南北朝",386,589); +add_dynasty($dynasty); +$dynasty = array("隋",581,618); +add_dynasty($dynasty); +$dynasty = array("唐",618,907); +add_dynasty($dynasty); +$dynasty = array("五代",907,959); +add_dynasty($dynasty); +$dynasty = array("宋",960,1279); +add_dynasty($dynasty); +$dynasty = array("遼",916,1125); +add_dynasty($dynasty); +$dynasty = array("金",1115,1234); +add_dynasty($dynasty); +$dynasty = array("元",1260,1367); +add_dynasty($dynasty); +$dynasty = array("西夏",1032,1227); +add_dynasty($dynasty); +$dynasty = array("明",1368,1644); +add_dynasty($dynasty); +$dynasty = array("清",1616,1911); +add_dynasty($dynasty); +$dynasty = array("民國",1911,9999); +add_dynasty($dynasty); + + +// dynasty list ref: http://dict.revised.moe.edu.tw/htm/fulu/nh.htm + +?> \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/add_missing_books_to_sections.php --- a/interface/add_missing_books_to_sections.php Mon Jan 26 12:19:39 2015 +0100 +++ b/interface/add_missing_books_to_sections.php Tue Jan 27 16:40:30 2015 +0100 @@ -16,19 +16,11 @@ if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } -?> - - - - - - - +add_missing_books_to_sections(); + + + \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/check_sections.php --- a/interface/check_sections.php Mon Jan 26 12:19:39 2015 +0100 +++ b/interface/check_sections.php Tue Jan 27 16:40:30 2015 +0100 @@ -71,18 +71,19 @@ function checkSections_sort_by($sort_by){ switch ($sort_by) { case 'time': - $query="(SELECT name AS book_name,level1,level2,period,start_year,id from books ORDER BY start_year)"; + $query="(SELECT name AS book_name,level1,level2,period,dynasty,start_year,id from books ORDER BY start_year)"; $result = mysql_query($query); echo mysql_num_rows($result)." result(s)

"; echo ""; echo ""; - echo ""; $str.="
book namelevel1level2periodstart_year"; + echo "book namelevel1level2perioddynastystart_year"; while ($row = mysql_fetch_assoc($result)) { $str="
".$row['book_name']; $str.="".$row['level1']; $str.="".$row['level2']; $str.="".$row['period']; + $str.="".$row['dynasty']; $str.="".$row['start_year']; $str.=""."click here".""; echo $str; @@ -106,7 +107,7 @@ - + diff -r f196939ccc03 -r 883ad980a43b interface/check_sections_details.php --- a/interface/check_sections_details.php Mon Jan 26 12:19:39 2015 +0100 +++ b/interface/check_sections_details.php Tue Jan 27 16:40:30 2015 +0100 @@ -100,13 +100,13 @@ - + - + - + diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/.DS_Store Binary file interface/dynasty_period_list/.DS_Store has changed diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/三國.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/三國.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,33 @@ +黃初 +太和 +青龍 +景初 +正始 +嘉平 +正元 +甘露 +景元 +咸熙 +章武 +建興 +延熙 +景耀 +炎興 +黃武 +黃龍 +嘉禾 +赤烏 +太元 +神鳳 +建興 +五鳳 +太平 +永安 +元興 +甘露 +寶鼎 +建衡 +鳳凰 +天鍹 +天璽 +天紀 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/五代.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/五代.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,15 @@ +開平 +乾化 +貞明 +龍德 +同光 +天成 +長興 +應順 +清泰 +天福 +開運 +天福 +乾祐 +廣順 +顯德 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/元.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/元.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,15 @@ +中統 +至元 +元貞 +大德 +至大 +皇慶 +延祐 +至治 +泰定 +致和 +天曆 +至順 +元統 +至元 +至正 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/南北朝.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/南北朝.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,93 @@ +永初 +景平 +元嘉 +孝建 +大明 +永光 +景和 +泰始 +泰豫 +元徽 +昇明 +建元 +永明 +隆昌 +延興 +建武 +永泰 +永元 +中興 +天監 +普通 +大通 +中大通 +大同 +中大同 +太清 +大寶 +天正 +承聖 +天成 +紹泰 +太平 +永定 +天嘉 +天康 +光大 +太建 +至德 +禎明 +登國 +皇始 +天興 +天賜 +永興 +神瑞 +泰常 +始光 +神麚 +延和 +太延 +太平真君 +正平 +承平 +興安 +興光 +太安 +和平 +天安 +皇興 +延興 +承明 +太和 +景明 +正始 +永平 +延昌 +熙平 +神龜 +正光 +孝昌 +武泰 +建義 +永安 +建明 +普泰 +中興 +太昌 +永興 +永熙 +天平 +元象 +興和 +武定 +大統 +天保 +乾明 +皇建 +太寧 +河清 +天統 +武平 +隆化 +承光 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/唐.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/唐.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,57 @@ +武德 +貞觀 +永徽 +顯慶 +龍朔 +麟德 +乾封 +總章 +咸亨 +上元 +儀鳳 +調露 +永隆 +開耀 +永淳 +弘道 +嗣聖 +神龍 +景龍 +唐隆 +景雲 +太極 +延和 +先天 +開元 +天寶 +至德 +乾元 +上元 +寶應 +廣德 +永泰 +大曆 +建中 +興元 +貞元 +永貞 +元和 +長慶 +寶曆 +太和 +開成 +會昌 +大中 +咸通 +乾符 +廣明 +中和 +光啟 +文德 +龍紀 +大順 +景福 +乾寧 +光化 +天復 +天祐 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/宋.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/宋.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,57 @@ +建隆 +乾德 +開寶 +太平興國 +雍熙 +端拱 +淳化 +至道 +咸平 +景德 +大中祥符 +天禧 +乾興 +天聖 +明道 +景祐 +寶元 +康定 +慶曆 +皇祐 +至和 +嘉祐 +治平 +熙寧 +元豐 +元祐 +紹聖 +元符 +建中靖國 +崇寧 +大觀 +政和 +重和 +宣和 +靖康 +建炎 +紹興 +隆興 +乾道 +淳熙 +紹熙 +慶元 +嘉泰 +開禧 +嘉定 +寶慶 +紹定 +端平 +嘉熙 +淳祐 +寶祐 +開慶 +景定 +咸淳 +德祐 +景炎 +祥興 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/明.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/明.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,21 @@ +洪武 +建文 +永樂 +洪熙 +宣德 +正統 +景泰 +天順 +成化 +弘治 +正德 +嘉靖 +隆慶 +萬曆 +萬厯 +萬歷 +泰昌 +天啟 +天啓 +崇禎 +永曆 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/晉.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/晉.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,36 @@ +泰始 +咸寧 +太康 +太熙 +永熙 +永平 +元康 +永康 +永寧 +太安 +永安 +建武 +永安 +永興 +光熙 +永嘉 +建興 +建武 +太興 +永昌 +太寧 +咸和 +咸康 +建元 +永和 +升平 +隆和 +興寧 +太和 +咸安 +寧康 +太元 +隆安 +元興 +義熙 +元熙 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/民國.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/民國.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,1 @@ +民國 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/清.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/清.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,15 @@ +天命 +天聰 +崇德 +順治 +康熙 +雍正 +乾隆 +嘉慶 +嘉靖 +道光 +咸豐 +同治 +光緒 +光緖 +宣統 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/漢.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/漢.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,83 @@ +建元 +崇正 +元光 +元朔大徳 +元狩 +元鼎 +元封 +太初 +天漢 +太始 +征和 +後元 +始元 +元鳳 +元平 +本始 +地節 +元康 +神爵 +五鳳 +甘露 +黃龍 +初元 +永光 +建昭 +竟寧 +建始 +河平 +陽朔 +鴻嘉 +永始 +元延 +綏和 +建平 +元壽 +元始 +居攝 +初始 +更始 +始建國 +天鳳 +地皇 +建武 +建武中元 +中元 +永平 +建初 +元和 +章和 +永元 +元興 +延平 +永初 +元初 +永寧 +建光 +延光 +永建 +陽嘉 +永和 +漢安 +建康 +永喜 +本初 +建和 +和平 +元嘉 +永興 +永壽 +延熹 +永康 +建寧 +熹平 +光和 +中平 +光熹 +昭寧 +永漢 +中平 +初平 +興平 +建安 +延康 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/西夏.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/西夏.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,32 @@ +顯道 +開運 +廣運 +大慶 +天授禮法延祚 +延嗣寧國 +天祐垂聖 +福聖承道 +奲都 +拱化 +乾道 +天賜禮盛國慶 +大安 +天安禮定 +天儀治平 +天祐民安 +永安 +貞觀 +雍寧 +元德 +正德 +大德 +大慶 +人慶 +天盛 +乾祐 +天慶 +應天 +皇建 +光定 +乾定 +寶義 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/遼.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/遼.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,22 @@ +神冊 +天贊 +天顯 +會同 +大同 +天祿 +應曆 +保寧 +乾亨 +統和 +開泰 +太平 +景福 +重熙 +清寧 +咸雍 +太康 +大安 +壽昌 +乾統 +天慶 +保大 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/金.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/金.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,21 @@ +收國 +天輔 +天會 +天眷 +皇統 +天德 +貞元 +正隆 +大定 +明昌 +承安 +泰和 +大安 +崇慶 +至寧 +貞祐 +興定 +元光 +正大 +開興 +天興 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/dynasty_period_list/隋.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/dynasty_period_list/隋.txt Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,4 @@ +開皇 +仁壽 +大業 +義寧 \ No newline at end of file diff -r f196939ccc03 -r 883ad980a43b interface/intermediate_results/.DS_Store Binary file interface/intermediate_results/.DS_Store has changed diff -r f196939ccc03 -r 883ad980a43b interface/intermediate_results/missing_books.csv --- a/interface/intermediate_results/missing_books.csv Mon Jan 26 12:19:39 2015 +0100 +++ b/interface/intermediate_results/missing_books.csv Tue Jan 27 16:40:30 2015 +0100 @@ -398,6 +398,7 @@ 38467,"興平縣志" 17469,"興平縣志" 38409,"三原縣志" +40265,"武功縣志" 35460,"武功縣續志" 38395,"華州志" 38429,"郃陽縣志" diff -r f196939ccc03 -r 883ad980a43b interface/tagging_text_20150127.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/tagging_text_20150127.php Tue Jan 27 16:40:30 2015 +0100 @@ -0,0 +1,1155 @@ +", $stringInput); + $stringInput = preg_replace("/【(.*?)】/u", "【\\1】", $stringInput); +} else { + $query = sprintf("SELECT `content`, `line`, `books_id` FROM `contents` WHERE `books_id`=\"%s\" AND `line`>=%d AND `line`<=%d", $bookId, $startPage, $endPage); + $result = mysql_query($query); + while ($row = mysql_fetch_assoc($result)) { + $contentString.="【".$row['line']."】".$row['content']."\n"; + } + $stringInput = $contentString; + $stringInput = preg_replace("/<(.*?)>/u", "○", $stringInput); + $stringInput = preg_replace("/ /u", "○", $stringInput); + $stringInput = preg_replace("/\n/u", "
", $stringInput); + $stringInput = preg_replace("/【(.*?)】/u", "【\\1】", $stringInput); +} + + +$taglistArray=""; +$query = sprintf("SELECT * FROM `taglist` WHERE `systemName`='%s' ORDER BY `tag` ASC", $systemNAME); +$result = mysql_query($query); +while ($row = mysql_fetch_assoc($result)) { + $taglistArray[] = array( $row['id'], $row['name'], $row['tag'], $row['color'] ); +} + +function sortFunction($a,$b) { + return strlen($b)-strlen($a); +} + +$wordlistArray=""; +$query = sprintf("SELECT * FROM `wordlist` WHERE `systemName`='%s' ORDER BY `name` ASC", $systemNAME); +$result = mysql_query($query); +while ($row = mysql_fetch_assoc($result)) { + $listString = file_get_contents("wordlist/".$row['id'].".txt"); + $listString = preg_replace("/
/u", "\n", $listString); + $listString = preg_replace("/<\/div>/u", "", $listString); + $listString = preg_replace("//u", "", $listString); + $listString = preg_replace("/<\/span>/u", "", $listString); + //$listString = preg_replace("/\n/u", "|", $listString); + + $wordlistArray2 = explode( "\n", $listString ); + usort($wordlistArray2,'sortFunction'); + foreach ( $wordlistArray2 as $index=>$value ) { + $wordlistArray2[$index] = implode("○?", preg_split("/(?$value ) { + if ($value=="") unset($wordlistArray2[$index]); + + } + $listString = implode("|", $wordlistArray2); + + if ( $listString[0]=="|" ) $listString = substr($listString, 1); + $wordlistArray[] = array( $row['id'], $row['name'], $listString ); +} + +?> + + + + + + + + + + + + + + +
+
+
+
+ + +
+
+ Replace By Smart Regex©: +

+
+ Range: to
+
+
+ + +
+
+ +
+ Tag by rule: +
+
+ + + +
+ +
+ Edit: + +
+
+
+
+
+
+ +
+ Export: + Page: to
+
+
+
+ +
+ Replace By Regex: + Range: to
+ Regex:
+ Replace:
+ +
+
+
+
+ + diff -r f196939ccc03 -r 883ad980a43b map/.DS_Store Binary file map/.DS_Store has changed