使用人数:123人
词性分割

  1. 接口介绍:将一段句子进行中文分词,并为分词进行词性标注
  2. 接口地址: http://open-api-nlp.luzhi.online/NLP/GetLexer
  3. 请求方式: GET
  4. 返回格式: JSON
  5. 请求参数说明:
    名称 必须 类型 说明
    token String 接口调用授权签名
    text 必须 String 需要进行词性分割的句子
  6. 请求示例:
    http://open-api-nlp.luzhi.online/NLP/GetLexer?token=***&text=下周三下午五点半去打球
  7. 返回参数:
    名称 类型 说明
    code int 响应码。成功为200,其余参见接口调用响应码表
    msg String 返回消息。成功返回Succeed。其余错误消息为对应错误码的提示。
    data Object 返回数据。数据类型为Json格式的Object
    data数据说明:
    word_type String 分词词性
    word_item String 分词文字
  8. 正确返回示例:
    {
      "code": 200,
      "message": "Succeed",
      "data": [
        {
          "word_type": "TIME",
          "word_item": "下周三下午五点半"
        },
        {
          "word_type": "v",
          "word_item": "去"
        },
        {
          "word_type": "v",
          "word_item": "打球"
        }
      ]
    }
  9. 错误返回示例:
    {
      "code": 401,
      "message": "Sign is error",
      "data": null
    }
  10. 参考代码:

    
            //using System.IO;
            //using System.Text;
            //using System.Net;
            //using System.Net.Security;
            static void Main(string[] args)
            {
                String method = "GET";
                String url = "http://open-api-nlp.luzhi.online/NLP/GetLexer?token=***&text=下周三下午五点半去打球";
                HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url); 
                httpRequest.Method = method;
                try
                {
                    HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
                    Stream st = httpResponse.GetResponseStream();
                    StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
                    Console.WriteLine(reader.ReadToEnd());
                    Console.WriteLine("\n");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
                                                 

     
         
        public static void main(String[] args) throws IOException
        { 
            String url = "http://open-api-nlp.luzhi.online/NLP/GetLexer?token=***&text=下周三下午五点半去打球";
        
            HttpClient httpClient = HttpClients.custom().build();
            HttpGet get = new HttpGet(url);
        
            HttpResponse response = httpClient.execute(get);
            HttpEntity resp_entity = response.getEntity();
            resp_entity.getContent();
        
            String resp_content = EntityUtils.toString(resp_entity,StandardCharsets.UTF_8);
        
            System.out.println(resp_content);
        } 
                                             

    
        import json, urllib
        from urllib import urlencode
    
        url = "http://*****"
        params = { 
            "token": "*************",     # 授权签名 
            "param1":"……"               # 参数1                                       
        }
        params = urlencode(params)
        f = urllib.urlopen(url, params)
        content = f.read()
        res = json.loads(content)
        if res:
            print(res)
        else:
            print("请求异常")