Location: PHPKode > scripts > Fast Chinese Word Segmentation > fast-chinese-word-segmentation/test.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Fast Chinese Word Segmentation</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
body {
    margin: 0.5em;
    background-color: #FFFFFF;
    color: #000000;
    font-family: ËÎÌå;
    font-size: 100%;
}

textarea {
    font-family: ËÎÌå;
    font-size: 100%;
}

.header_title {
    margin-bottom: 0.2em;
    text-align: center;
    font-family: Arial;
    font-size: large;
    font-weight: bold;
}
</style>
</head>
<body>
<div class="header_title">Fast Chinese Word Segmentation</div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <b>ÄÚÈÝ:</b><br>
    <br>
    <textarea name="data" rows="6" cols="80" style="width: 100%;"><?php
if (array_key_exists('data', $_POST)) {
    echo htmlspecialchars($_POST['data']);
} else {
    echo 'È®£¬Ë׳ƹ·£¬ÎªÒ»ÖÖ³£¼ûµÄÈ®¿Æ²¸È鶯ÎÊÇÀǵĽüÇס£¹·ÊÇÒ»ÖÖ²»ÍíÓÚ14000ÄêÇ° - ¸ü¿ÉÄÜÔÚ15000ÄêÇ°£¬¾ÍÒѾ­±»ÈËÀàѱ»¯µÄ¼ÒÐó¡£½ñÌ죬¼ÒÈ®ÒѾ­´æÔÚÊý°ÙÖÖÀà¡£°üÀ¨´Ó¸ß¶ÈÖ»ÓÐÊ®¼¸ÀåÃ×(ÈçÆæÍßÍßС¹·)µ½½Ó½üÒ»Ã׸ߵľÞÈ®(Èç°®¶ûÀ¼ÁÔÀÇÈ®)£¬ÑÕÉ«Ò²´Ó°×É«µ½ºÚ¡¢ºì¡¢»Ò»ò×ض¼ÓС£¼ÒÈ®£¬ÈçͬÈËÀàÒ»Ñù£¬ÊǸ߶ÈÉç»á»¯µÄ¼¯ÌåÁÔʳ¶¯Îï¡£Õâ´ó¸Å¾ÍÊÇΪʲôËüÃǵÄ×ÜÌåÐÐΪÊÇ¿ÉÊÜѵ£¬ÓÐȤ²¢ÊʺÏÈËÀà¾Ó¼Ò¼°Éç»á»·¾³ÁË¡£';
}
?></textarea><br>
    <div align="right"><input type="submit" value="Ìá½»·Ö´ÊÎı¾"></div>
</form>
<?php
if (array_key_exists('data', $_POST)) {
    include_once 'cwordseg_fast.lib.php';
    $Segmentation = new Segmentation;
    $Segmentation->load('cwordict_fast.dic');
    $Segmentation->setLowercase(FALSE);
    $Segmentation->setSegmentEnglish(TRUE);
    $result = nl2br(htmlspecialchars($Segmentation->segmentString($_POST['data'])));
    echo "<b>½á¹û</b> (´ÊÁ¿: " . number_format(count($Segmentation->dict_words)) . ", ´Êµä: " . htmlspecialchars($Segmentation->getDictName()) . "): <br>\n<br>\n$result";
}
?>
</body>
</html>
Return current item: Fast Chinese Word Segmentation