附加功能---显示词库的分类信息

这个功能比较简单,显示A-Z的大分类下有多少划词分类,点击划词分类可以显示这个分类下有多少单词,点击单词可以获得翻译。。。。


这个词库就是前面10篇用到的词库,总共有2万多个单词


<html>
<head>
</head>
<body bgcolor="#RGB(67,65,65)">
<img src="../image/logo.jpg" style='margin-left: 400px;'/><br />
<?php 
require_once "../groupDicName.class.php";
require_once "../storeWord.class.php";
$groupName = new GroupDicName();
$dicSort=trim($groupName->getIndex());
$storeword = new StoreWord();
//echo $dicSort; exit();
$words=explode('#', $dicSort);
$sortDict;
foreach($words as $word)
{
	$sortChar = substr($word, 0,1);
	$sortDict["$sortChar"][]=$word;
}
echo "<div style='margin-left: 403px; '>";
echo "<table border='1' style='width: 700px;'>";
echo "<tr><td colspan='3' style='color:#a00; padding-left: 300px;' >字典统计信息</td></tr>";
echo "<tr style='color: 003300;'><td>单词大类</td><td>单词分类</td><td>单词数量</td></tr>";
$totalNum=0;
foreach($sortDict as $subDict)
{
	$rowspan = count($subDict)+1;
	echo "<tr><td rowspan='$rowspan'>".substr($subDict[0],0,1)."</td></tr>";
	foreach($subDict as $word)
	{
		$totalNum += $storeword->getNumWord($word);
		echo "<tr><td><a href='wordList.php?wordlist=$word' target='_blank' title='点击查看具体单词' style='text-decoration: none; color: 0000ee'>$word</a></td><td>".$storeword->getNumWord($word)."</td></tr>";
	}
}
echo "<tr><td colspan='2'>附注:<span style='color:e00'>(-)</span> 表示起始<span style='color:e00'>(,)</span>表示包含范围 <span style='color:e00'>(~)</span>表示单词的跨度</td><td>单词总数<span style='color:e00'>($totalNum)</span></td></tr>";
echo "</table>";
?>
</body>
</html>


<html>
<head>
<style type="text/css">
td{text-align:center;color: #000000;}
</style>
</head>
<body bgcolor="#RGB(67,65,65)">
<img src="../image/logo.jpg" style='margin-left: 400px;'/><br />
<?php 
require_once "../storeWord.class.php";
if(!empty($_GET['wordlist']))
{
	$wordGroup = $_GET['wordlist'];
	$storeword = new StoreWord();
	$words = $storeword->getAllWord($wordGroup);
	echo "<div style='margin-left: 403px; '>";
	echo "<table border='1' style='width: 715px;'>";
	$len = count($words);
	for($i=0; $i<$len; $i=$i+4)
	{
		$one = isset($words[$i])?$words[$i]:'';
		$two = isset($words[$i+1])?$words[$i+1]:'';
		$three = isset($words[$i+2])?$words[$i+2]:'';
		$four = isset($words[$i+3])?$words[$i+3]:'';
		echo "<tr><td><a href='trans.php?word={$one}' target = '_blank' style='text-decoration: none'>{$one}</a></td><td><a href='trans.php?word={$two}' target = '_blank'  style='text-decoration: none'>{$two}</a></td><td><a href='trans.php?word={$three}' style='text-decoration: none' target = '_blank' >{$three}</a></td><td><a href='trans.php?word={$four}' style='text-decoration: none' target = '_blank' >{$four}</a></td></tr>";
	}
	echo "</table>";
}
?>
</html>
<html>
<head>
<style type="text/css">
td{text-align:center;color: #000000;}
</style>
</head>
<body bgcolor="#RGB(67,65,65)">
<img src="../image/logo.jpg" style='margin-left: 400px;'/><br />
<?php
require_once "../storeWord.class.php";
require_once "../processCheck.class.php";
require_once "../format.class.php";
if(!empty($_GET['word']))
{
	$word = $_GET['word'];
	$check = new Check();
	$store = new StoreWord();
	$trans = new FormatTrans();
	$wordzone = $check->matchDic($word);
	$trans =$trans->trans($store->getWord($wordzone, $word));
	echo "<div style='margin-left: 410px; width: 715px; '>";
	foreach ($trans as $translation)
	{
		echo "<p  style='background-color: #acacac; border:1px solid grey; width: 650px ; padding-left: 15px; text-indent: 18px;'>{$translation}</p>";
	}
	echo "</div>";
}
?>
</body>
</html>



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值