step5.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?php
  2. require_once "install_head.php";
  3. ?>
  4. <html>
  5. <head>
  6. </head>
  7. <body>
  8. <style>
  9. #step5{
  10. background-color: #f1e7a4;
  11. }
  12. </style>
  13. <?php
  14. require_once 'nav_bar.php';
  15. ?>
  16. <h3>Step 4 Build Pali Canon Database 建立三藏语料数据库</h3>
  17. <div class="card" style="background-color:#f1e7a4;">
  18. 你可以下载已经制作好的语料数据库放在项目文件夹中
  19. <a href="https://www.dropbox.com/s/naf7sk9i9sf0dfi/appdata.7z?dl=0">drobox 7z format 754MB</a>
  20. 解压缩后放在项目tmp目录中
  21. <pre>
  22. [tmp]
  23. └appdata
  24. └dict
  25. └3rd
  26. └system
  27. └palicanon
  28. └user
  29. </pre>
  30. </div>
  31. <?php
  32. $dbfile[] = array(_FILE_DB_BOLD_, "bold.sql");
  33. $dbfile[] = array(_FILE_DB_INDEX_, "index.sql");
  34. $dbfile[] = array(_FILE_DB_BOOK_WORD_, "bookword.sql");
  35. $dbfile[] = array(_FILE_DB_PALI_INDEX_, "paliindex.sql");
  36. $dbfile[] = array(_FILE_DB_WORD_INDEX_, "wordindex.sql");
  37. $dbfile[] = array(_FILE_DB_PALI_SENTENCE_, "pali_sent.sql");
  38. $dbfile[] = array(_FILE_DB_PALITEXT_, "pali_text.sql");
  39. $dbfile[] = array(_FILE_DB_RESRES_INDEX_, "res.sql");
  40. $dir = "./palicanon_db/";
  41. if (isset($_GET["index"])) {
  42. /*
  43. echo '<div style="padding:10px;margin:5px;border-bottom: 1px solid gray;background-color:yellow;">';
  44. $index = $_GET["index"];
  45. $dns = "" . $dbfile[$index][0];
  46. $dbh = new PDO($dns, "", "", array(PDO::ATTR_PERSISTENT => true));
  47. $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  48. //建立数据库
  49. $_sql = file_get_contents($dir . $dbfile[$index][1]);
  50. $_arr = explode(';', $_sql);
  51. //执行sql语句
  52. foreach ($_arr as $_value) {
  53. $dbh->query($_value . ';');
  54. }
  55. echo $dns . "建立数据库成功";
  56. echo "</div>";
  57. */
  58. }
  59. ?>
  60. <div class="card">
  61. <h4>拆分html文件</h4>
  62. <a href="xmlmaker.php">拆分</a><br>
  63. <a href="../../log/palicanoon.log" target="_blank">view log file</a>
  64. </div>
  65. <div class="card">
  66. <h4>逐词解析模板数据库</h4>
  67. <?php
  68. if (file_exists(_DIR_PALICANON_TEMPLET_)) {
  69. $iCount = 0;
  70. for ($i = 1; $i <= 217; $i++) {
  71. if (file_exists(_DIR_PALICANON_TEMPLET_ . "/p{$i}_tpl.db3")) {
  72. $iCount++;
  73. }
  74. }
  75. if ($iCount == 217) {
  76. echo "文件已经存在。<br>";
  77. echo '<a href="db_insert_templet.php">重新生成数据库</a>';
  78. } else {
  79. echo "缺少" . (217 - $iCount) . "个文件<br>";
  80. echo '<a href="db_insert_templet.php">生成数据库</a>';
  81. }
  82. } else {
  83. echo "模板数据库目录不存在<br>";
  84. }
  85. ?>
  86. </div>
  87. <div class="card">
  88. <h4>单词索引表</h4>
  89. <div class="contence">
  90. <!--
  91. <a href="db_insert_index.php" target="_blank">生成-一本书一次写入</a><br>
  92. <a href="db_insert_index_once.php" target="_blank">一次生成所有的书</a><br>
  93. <a href="db_insert_index_csv.php" target="_blank">生成中间csv文件(项目文档已经有了。无需生成)</a><br>
  94. -->
  95. <a href="db_insert_bookword_from_csv.php" target="_blank">从csv文件导入书单词索引表(bookword)</a><br>
  96. <a href="db_insert_word_from_csv.php" target="_blank">从csv文件导入单词表(paliindex)</a><br>
  97. <a href="db_insert_wordindex_from_csv.php" target="_blank">从csv文件导入单词索引表(wordindex)</a><br>
  98. </div>
  99. </div>
  100. <div class="card">
  101. <h4>黑体字数据库</h4>
  102. <?php
  103. echo '<div style="padding:10px;margin:5px;border-bottom: 1px solid gray;">';
  104. echo "</div>";
  105. ?>
  106. <div class="contence">
  107. <a href="db_insert_bold.php" target="_blank">生成</a>
  108. </div>
  109. </div>
  110. <div class="card">
  111. <h4>Pali句子库</h4>
  112. <div style="padding:10px;margin:5px;border-bottom: 1px solid gray;display:flex;">
  113. </div>
  114. <div class="contence">
  115. <a href="db_insert_sentence.php">重新生成</a>
  116. </div>
  117. </div>
  118. <div class="card">
  119. <h4>Pali原文库</h4>
  120. <div>
  121. <?php
  122. $db = $dbfile[6];
  123. echo '<div style="padding:10px;margin:5px;border-bottom: 1px solid gray;">';
  124. echo '<a href="db_insert_palitext.php">生成</a><br>';
  125. echo '<a href="db_update_palitext.php" target="_blank">更新</a><br>';
  126. echo "<a href = '" . _DIR_LOG_ . "/db_update_palitext.log" . "' target='_blank'>view Log</a>"
  127. ?>
  128. </div>
  129. </div>
  130. <div class="card">
  131. <h4>标题索引</h4>
  132. <div>
  133. <?php
  134. $db = $dbfile[7];
  135. echo '<div style="padding:10px;margin:5px;border-bottom: 1px solid gray;display:flex;">';
  136. echo '<div style="flex:3;">';
  137. echo '<a href="db_update_toc.php" target="_blank">更新</a><br>';
  138. echo "</div>";
  139. echo "<a href = '" . _DIR_LOG_ . "/db_update_title.log" . "' target='_blank'>view Log</a>"
  140. ?>
  141. </div>
  142. </div>
  143. <hr>
  144. <h2>完成</h2>
  145. </body>
  146. </html>