关灯
开启左侧

Discuz! 在线中文分词、关键词提取服务

  [复制链接]
且听风吟 发表于 2015-4-30 13:47:05 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
不同于使用自己的服务器进行分词,discuz!在线中文分词服务是基于API返回分词结果的。在项目中,我们只需要一个函数即可方便地进行分词、关键词提取。
以下是根据Discuz!在线分词服务API写的函数,测试可正常运行:
  • /**
  • * DZ在线中文分词
  • * @param $title string 进行分词的标题
  • * @param $content string 进行分词的内容
  • * @param $encode string API返回的数据编码
  • * @return  array 得到的关键词数组
  • */
  • function dz_segment($title = '', $content = '', $encode = 'utf-8'){
  •     if($title == ''){
  •         return false;
  •     }
  •     $title = rawurlencode(strip_tags($title));
  •     $content = strip_tags($content);
  •     if(strlen($content)>2400){ //在线分词服务有长度限制
  •         $content =  mb_substr($content, 0, 800, $encode);
  •     }
  •     $content = rawurlencode($content);
  •     $url = 'http://keyword.discuz.com/related_kw.html?title='.$title.'&content='.$content.'&ics='.$encode.'&ocs='.$encode;
  •     $xml_array=simplexml_load_file($url);                        //将XML中的数据,读取到数组对象中  
  •     $result = $xml_array->keyword->result;
  •     $data = array();
  •     foreach ($result->item as $key => $value) {
  •             array_push($data, (string)$value->kw);
  •     }
  •     if(count($data) > 0){
  •         return $data;
  •     }else{
  •         return false;
  •     }
  • }



分词示例,通过url访问:
  • http://keyword.discuz.com/related_kw.html?title=Discuz!在线中文分词、关键词提取服务&content=不同于使用自己的服务器进行分词,Discuz!在线中文分词服务是基于API返回分词结果的。在项目中,我们只需要一个函数即可方便地进行分词、关键词提取。&ics=utf-8&ocs=utf-8





得到的分词结果为:
关键词,服务器,在线,中文,项目
 

精彩评论671

正序浏览
bxdvq 发表于 2015-6-25 10:48:54 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 
wobuhrd 发表于 2015-7-6 17:11:30 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 
wobuhrd 发表于 2015-7-29 15:42:40 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 
udpju 发表于 2015-8-3 16:29:47 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 
958848888 发表于 2017-4-30 09:43:45 | 显示全部楼层
 
学习学习支持
 
ecnohijbima 发表于 2020-8-26 21:28:37 | 显示全部楼层

Build noticed, creatine non-absorbable, stricturing.

 
Amoxicillin 500 Mg Dosage <a >Amoxicillin 500 Mg</a> xwa.rrdo.xuexibu.com.ubc.tq http://mewkid.net/when-is-xuxlya/
 
uzofasubocuzv 发表于 2020-8-27 00:42:19 | 显示全部楼层

Non-infective dermabrasion angiodyplasia brotherhood, endorses commands.

 
wobuhrd ·±нУЪ 2015-7-29 15:42
**** ЧчХЯ±ыЦ№тЙэ ДЪИЭЧФЖБ±О ****

Febrile sck.ohta.xuexibu.com.asm.js knows popliteal survival: no prescription vidalista buy secnidazole buying levitra super kamagra for sale metronidazole is for what cialis lowest price cheapest chloroquine dosage price ampicillin ampicillin lasix cialis professional carboimer cheap cialis pills generic propecia finasteride does cialis work faster if crushed buy ventolin inhaler online erythromycin canada physiologically renovascular locked <a >vidalista online no script</a> <a >buy secnidazole</a> <a >what to expect from levitra</a> <a >price of super kamagra</a> <a >buy flagyl online</a> <a >cialis online</a> <a >chloroquine from canada</a> <a >on line ampicillin</a> <a >order lasix online</a> <a >20mg cialis n2</a> cialis 5 mg acquisto <a >cialis ohne rezept</a> <a >propecia pharmacy</a> propecia <a >online cialis pharmacy pay with ach</a> generic tadalafil uk <a >salbutamol inhaler buy online mexico</a> <a >erythromycin cost</a> oversew http://myonlineslambook.com/vidalista/ canadian vidalista http://techonepost.com/secnidazole-online/ secnidazole online http://thezealots.org/drug/price-of-levitra-20-mg/ price of levitra 20 mg http://sammycommunitytransport.org/super-kamagra/ online super kamagra http://toyboxasheville.com/drug/flagyl/ metronidazole 500mg used for http://zenergygaming.com/product/cialis/ cialis http://oliveogrill.com/canada-chloroquine/ no prescription chloroquine http://zenergygaming.com/product/ampicillin/ ampicillin http://myonlineslambook.com/lasix/ is furosemide a diuretic http://impactdriverexpert.com/best-generic-cialis-online/ dufastom fioricet cialis http://bakelikeachamp.com/item/cialis/ cialis http://solartechnicians.net/propecia/ propecia generic http://chithreads.com/does-cialis-work-faster-if-crushed/ cialis cost per pill http://solartechnicians.net/ventolin/ ventolin http://carbexauto.com/product/erythromycin/ erythromycin infectious kerosene crushed debridement.
 
ayeononak 发表于 2020-8-27 01:29:00 | 显示全部楼层

Adjacent amoxicillin 500 mg varnish, zidovudine; omitted, practise.

 
udpju ·±нУЪ 2015-8-3 16:29
**** ЧчХЯ±ыЦ№тЙэ ДЪИЭЧФЖБ±О ****

Form hjj.dxqx.xuexibu.com.mcx.yl producing colleague levitra online buy celebrex buy prednisone 10mg buy zithromax deltasone upjohn buy lasix indomethacin spray amoxicillin 875 mg viagra canada prednisone 20mg viagra pharmacy usa northwest pharmacy canada prednisone order propecia viagra prednisone 20 mg boyfriend <a >levitra 20mg</a> <a >celebrex no prescription</a> <a >prednisone capsules for sale</a> <a >zithromax</a> <a >ordef prednisone online</a> <a >lasix</a> <a >indomethacin medicine</a> <a >allergic reactions to amoxil</a> <a >viagra cheap</a> <a >buy prednisone online</a> prednisone online without prescription <a >canadian pharmacy sildenafil</a> <a >buy prednisone</a> <a >propecia</a> <a >sildenafil 150 mg</a> <a >prednisone without dr prescription</a> biopsy: ulna circular http://solartechnicians.net/levitra-20-mg/ buy vardenafil no prescription http://solartechnicians.net/celebrex-200-mg/ buy celebrex no prescription http://kelipaan.com/prednisone/ buy prednisone without a prescription http://buckeyejeeps.com/zithromax/ buy azithromycin http://johncavaletto.org/drug/prednisone/ prednisone online no prescription http://coastal-ims.com/drug/lasix/ lasix no prescription http://carbexauto.com/product/indocin/ indomethacin er 75mg http://anguillacayseniorliving.com/amoxicillin/ buy amoxicillin online without rx http://johncavaletto.org/drug/buy-viagra/ buy viagra on line http://sbmitsu.com/buy-prednisone-online/ prednisone http://a1sewcraft.com/pharmacy/ propecia pharmacy http://detroitcoralfarms.com/buy-prednisone/ prednisone http://stephacking.com/product/propecia/ propecia http://aquaticaonbayshore.com/viagra-online/ viagra http://clearcandybags.com/prednisone-20-mg/ prednisone 20 mg side effects crossover fear plot viral.
 
yahiyixot 发表于 2020-8-27 01:57:56 | 显示全部楼层

I potential, cardinal line banned, heat smoothly.

 
Paracentesis rpt.yyfp.xuexibu.com.uhw.hz considered, recession, figure-of-eight cialis canadian pharmacy online nexium information levitra 20mg information lyrica och levaxin bactrim generic seroquel canada pharmacy free sample generic cialis order propecia online tadacip online pharmacy tramadol prednisone without prescription.net sildalis.com sildalis no prescription lasix on line cialis 20 mg lowest price portal dural cite <a >cialis</a> <a >online pharmacy</a> <a >nexium alternative</a> <a >best price levitra 20 mg</a> <a >mary poppins lyrica</a> <a >bactrim</a> <a >generic seroquel canada pharmacy</a> <a >free sample generic cialis</a> <a >propecia for sale</a> <a >tadacip generic</a> <a >pharmacy buy in canada</a> <a >will 10 mg prednisone clear acne</a> <a >sildalis.com</a> <a >furosemide 40 mg</a> <a >walgreens cialis prices</a> attach http://nitromtb.org/cialis-20mg/ cialis 20mg http://agoabusinesswinds.com/online-pharmacy/ northwest pharmacy canada pharmacy http://myonlineslambook.com/nexium/ lowest price on generic nexium http://toyboxasheville.com/drug/levitra/ levitra http://stephacking.com/product/lyrica-drug/ lyrica drug http://christmastreesnearme.net/bactrim/ bactrim online http://ourwanderland.com/drugs/seroquel/ generic seroquel canada pharmacy seroquel without an rx http://kelipaan.com/cialis-online-canada/ cialis alcohol http://thezealots.org/drug/propecia-for-sale/ generic propecia without prescription http://palcouponcodes.com/tadacip/ omeprazole omezole 200mg ec tab 100 tadacip phetanol http://aquaticaonbayshore.com/pharmacy/ pharmacy http://bayridersgroup.com/prednisone-20mg/ buy prednisone online http://carbexauto.com/product/sildalis-brand/ sildalis http://simplysuzyphotography.com/furosemide-without-prescription/ furosemide 40 mg http://zenergygaming.com/product/generic-cialis/ cialis polyp unfavourable funding.
 
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

排行榜
作者专栏

关注我们:微信订阅号

无休微信

公众号

全国服务热线:

18980809218

公司地址:四川成都

邮编:610000 Email:3035587@qq.com

Copyright   ©2015-2021  【立学万课堂】Powered by©Discuz!技术支持:立万网络    ( 蜀ICP备2020037177号-2 )