中文分词工具,利用新浪sae平台的分词功能,开发的简单的分词API供大家免费使用!
方法
http://5.tbip.sinaapp.com/api.php?str=明天星期天&type=str
参数说明
str = 中文字符串(要分词的中文)
type =默认返回序列化后的数组
str 返回用,分隔的字符串 例如:明天,星期天
json 返回json结果
<?php $str=$_GET['str']; $type=$_GET['type']; $seg = new SaeSegment(); $ret = $seg->segment($str, 1); if($type=="str"){ foreach($ret as $v) { $keyword[]=$v['word']; }print_r(implode(",",$keyword)); }else if($type=="json") { print_r(json_encode($ret)); }else{ print_r(serialize($ret)); } // 失败时输出错误码和错误信息 if ($ret === false) var_dump($seg->errno(), $seg->errmsg()); ?>
以上就是中文分词API的内容,更多相关内容请关注PHP中文网(www.php.cn)!
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Assassin's Creed Shadows: Seashell Riddle Solution
2 weeks agoByDDD
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft