admin/app/common/services/wordanalysis/dict_build.php

32 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
//编译词库
ini_set('memory_limit', '128M');
error_reporting(E_ALL);
header('Content-Type: text/html; charset=utf-8');
require_once('phpanalysis.class.php');
$dicAddon = dirname(__FILE__).'/dict/not-build/base_dic_full.txt';
if( empty($_GET['ac']) )
{
echo "<div style='line-height:28px;'>请选择要进行的操作:<br />";
echo "1、<a href='?ac=make'>用原始文件(dict/not-build/base_dic_full.txt)生成一个标准词典;</a><br />";
echo "2、<a href='?ac=revert'>从默认词典(dict/base_dic_full.dic),反编译出原始文件。</a></div>";
exit();
}
if( $_GET['ac']=='make' )
{
\app\common\services\wordanalysis\PhpAnalysis::$loadInit = false;
$pa = new \app\common\services\wordanalysis\PhpAnalysis('utf-8', 'utf-8', false);
$pa->MakeDict( $dicAddon );
echo "完成词典创建!";
exit();
}
else
{
$pa = new \app\common\services\wordanalysis\PhpAnalysis('utf-8', 'utf-8', true);
$pa->ExportDict('base_dic_source.txt');
echo "完成反编译词典文件生成的文件为base_dic_source.txt ";
exit();
}
?>