词向量
2020年08月24日

词向量

服务器地址

接口须知

规则 描述
传输方式 HTTP
请求方法 POST
字符编码 UTF-8
响应格式 JSON
Header application/json

接口详情

接口地址

http://nlpapi.nlpbase.apigw-gz.didiyunapi.com/nlp/word_vec

接口描述

  1. 对传入的数据进行分词,并返回分词之后每个词的词向量结果。
  2. 默认会对传入的内容进行繁体转简体。
  3. 非中文词会按照OOV词处理, OOV词向量是零向量。
如果需要做接口定制,请联系我们

请求参数

参数名称 是否必选 数据类型 数据说明 示例数据 默认值
text string 传入文本数据 text=我爱北京天安门
ver string 使用的word embedding版本号,现支持v1.0、v2.0 ver=v1.0 v1.0
no_punc int 0: 保留标点;1: 删除标点 no_punc=1 0

响应参数

参数名称 是否必选 数据类型 数据说明
code int 返回码</br> 0表示成功,非0表示出错
msg string 返回错误信息
data object 返回结果结构体,code为0时有意义
+ word_vec list 返回的词向量结果,每一个词向量维度是200; OOV词的词向量是零向量
+ word_seg list 返回的分词结果
+ text string 经过繁简转换后的文本

Try it out

curl -X POST 'http://nlpapi.nlpbase.apigw-gz.didiyunapi.com/nlp/word_vec' -H 'content-type: application/json' -H 'Authorization: AppCode 开通服务获取appcode鉴权' -d '{"text": "我爱北京天安门"}'

返回正确JSON结果示例

{
    "code": 0,
    "data":{
          "text": "我爱北京天安门",
          "word_seg": ["我", "爱", "北京", "天安门"],
          "word_vec": [[-0.278891, -0.145961, -0.059513, -0.060288, -0.034035, -0.139316, -0.08562, -0.31949, 0.113938, 0.089906, -0.118895, 0.256581, 0.079663, -0.130526, 0.286279, -0.082408, 0.046806, 0.095923, -0.058095, -0.04505, 0.04622, -0.035161, -0.004243, -0.080903, 0.008537, 0.124053, -0.218012, 0.157751, 0.09682, 0.063821, 0.020947, 0.086874, -0.058243, -0.171736, -0.065275, -0.320092, 0.06877, 0.005442, 0.020016, -0.11107, -0.060684, -0.061488, 0.026864, 0.070539, 0.02697, -0.216605, -0.032435, 0.087893, -0.028259, -0.025378, 0.27176, -0.141466, -0.03848, -0.009257, 0.132501, -0.176142, -0.186023, 0.10593, 0.000713, -0.152492, -0.106753, 0.256639, -0.175585, -0.145358, 0.035748, 0.188675, -0.152509, -0.202246, 0.045598, 0.066638, -0.117134, 0.127251, -0.098371, -0.082445, -0.375072, 0.156309, -0.072497, -0.141478, 0.062849, -0.031233, -0.118008, 0.035191, 0.002786, -0.161956, 0.033948, 0.028406, -0.01763, -0.070363, 0.023464, 0.078912, 0.088233, 0.048083, -0.035571, -0.207016, 0.112575, -0.179341, -0.155052, 0.006364, -0.117993, 0.037241, -0.051262, 0.008566, 0.026354, -0.07387, 0.065745, -0.149079, -0.019622, -0.10042, 0.041894, 0.032998, 0.01594, -0.067205, -0.194678, 0.080245, 0.005828, -0.132939, 0.269722, 0.104929, 0.010951, -0.135391, -0.157403, -0.1402, 0.193684, -0.041206, 0.163027, -0.160509, 0.109068, -0.122369, 0.052232, 0.091564, 0.037443, -0.040591, 0.01398, -0.275564, -0.16303, -0.071189, 0.028141, -0.18332, 0.145228, 0.039882, -0.005552, -0.07565, 0.023465, -0.127594, 0.18642, 0.171353, -0.124588, 0.012274, -0.075753, 0.248976, 0.006244, 0.168563, -0.371779, 0.025323, 0.050438, 0.114548, 0.238478, -0.024547, -0.072716, 0.080575, 0.126886, -0.124265, -0.019795, 0.016115, -0.061674, 0.170213, 0.096383, 0.027121, -0.001534, 0.131617, -0.147851, 0.072358, 0.213422, -0.136975, 0.085838, 0.042904, -0.089658, -0.101493, 0.107289, -0.038306, -0.03627, -0.161045, -0.025803, 0.010182, 0.051332, 0.016385, -0.03676, -0.026251, -0.166362, -0.108783, -0.085456, -0.009663, 0.173996, -0.149342, -0.069419, 0.001461, -0.201875, -0.053883, -0.061326, 0.115264], [-0.001854, 0.011913, -0.228381, 0.207712, 0.041997, 0.278206, 0.392906, -0.318184, -0.458483, -0.171924, 0.10002, 0.085849, 0.116064, -0.17194, 0.427549, -0.367513, -0.304696, -0.003827, -0.026757, -0.351628, -0.332721, -0.115196, -0.04817, 0.328417, 0.190336, 0.163779, -0.023918, -0.448725, 0.201674, 0.06519, 0.066065, 0.206099, 0.462213, -0.337054, -0.08428, 0.198359, 0.280152, 0.060692, -0.647406, 0.009102, -0.162897, 0.084603, 0.184718, -0.008868, 0.354396, 0.128393, -0.101217, 0.335518, 0.093815, -0.649468, -0.006241, -0.248511, 0.255337, 0.3809, -0.028337, 0.064303, 0.085155, -0.042089, -0.089743, 0.36437, 0.04566, 0.398832, -0.079294, -0.016818, -0.232008, 0.431429, 0.015165, 0.094404, 0.066329, -0.182555, -0.2083, -0.281772, -0.014461, -0.090898, -0.597922, -0.026752, -0.148232, 0.050388, 0.01614, 0.210736, -0.268157, 0.379818, 0.053746, 0.054868, -0.329903, -0.460415, 0.245056, -0.012837, 0.405426, -0.424992, 0.302735, 0.107878, -0.098597, 0.392255, 0.206548, 0.207243, -0.081748, -0.525716, 0.473783, -0.248434, 0.125176, 0.100139, 0.266552, 0.004584, 0.043596, -0.424468, -0.007848, 0.323775, 0.238677, -0.023797, -0.281178, 0.05387, 0.523548, -0.272071, -0.008994, 0.035886, -0.05264, -0.444036, -0.149183, -0.21527, 0.133394, 0.228306, -0.024378, 0.003476, -0.141298, 0.026677, 0.522727, 0.105824, -0.126411, 0.020245, -0.137988, -0.222243, -0.141401, -0.408201, 0.482621, 0.06361, -0.041304, -0.301863, -0.377893, 0.082222, 0.061605, 0.232832, 0.088456, 0.057936, 0.054287, 0.41049, -0.520863, -0.23307, 0.15019, 0.105501, -0.019275, 0.038412, 0.284783, -0.06204, -0.20249, 0.149239, 0.588391, 0.150368, 0.09297, 0.270666, -0.187091, -0.50851, -0.042869, 0.019808, 0.247862, -0.554139, -0.045472, -0.100255, -0.29847, 0.036191, 0.31887, 0.362539, 0.216891, 0.132471, -0.347955, 0.027124, -0.252795, 0.25771, -0.275371, 0.135383, -0.258589, -0.591155, 0.44927, -0.234508, -0.128622, 0.304565, 0.004329, 0.091955, 0.687862, -0.428069, 0.415114, -0.006911, 0.262273, 0.081938, -0.189026, -0.058827, 0.027988, 0.517604, -0.644751, -0.218162], [0.245244, 0.256304, 0.118445, 0.088068, 0.108642, -0.279076, 0.283455, -0.313155, -0.114296, 0.408328, -0.049558, 0.402991, 0.355268, -0.093429, 0.279222, 0.406914, 0.031459, -0.216509, 0.024166, 0.296134, 0.372174, -0.1408, 0.118417, 0.240827, 0.223014, 0.344873, -0.169949, 0.106241, -0.146868, -0.359054, -0.26565, 0.066064, 0.28248, 0.591311, 0.392781, -0.178887, -0.174208, -0.449972, -0.296258, -0.172074, 0.248489, 0.17335, -0.063647, -0.251894, 0.298524, -0.175488, -0.09989, 0.583989, -0.37137, -0.227701, 0.109167, 0.402311, 0.307073, -0.09175, 0.193119, 0.052824, 0.263076, 0.024839, 0.076283, -0.203124, -0.000407, 0.447311, -0.082164, 0.341563, -0.237353, 0.204285, 0.29262, -0.48685, -0.051868, -0.329304, 0.357633, -0.129604, 0.20751, 0.159251, -0.039942, 0.003061, -0.16552, -0.148482, 0.052754, -0.134312, -0.133385, 0.08732, 0.58493, -0.025189, 0.03291, 0.099319, 0.006466, -0.174513, 0.051272, 0.194229, -0.25839, -0.166431, 0.108808, 0.078289, 0.211289, 0.383267, -0.349883, 0.231222, -0.354816, 0.180037, -0.195887, -0.267101, 0.427495, -0.28549, -0.021071, -0.22478, 0.421843, -0.007471, 0.374574, -0.293279, -0.329627, 0.037925, -0.202344, -0.267168, 0.550665, -0.201397, -0.318845, -0.28292, -0.476463, -0.004368, 0.014417, -0.286743, -0.221446, -0.820642, 0.254824, 0.304117, -0.069236, -0.095847, 0.394135, 0.095017, 0.106699, 0.004365, -0.338437, -0.429065, 0.45218, 0.272882, -0.120956, 0.290923, -0.305247, -0.32481, -0.567197, 0.146018, 0.349199, 0.071705, 0.306634, 0.342992, -0.694853, -0.041712, 0.407224, 0.083538, 0.01872, 0.552105, 0.063873, 0.035053, -0.022465, 0.408219, 0.096715, 0.196005, 0.380001, 0.026617, -0.096891, -0.015068, 0.444643, -0.266821, -0.244184, 0.230662, -0.202125, 0.232652, 0.194551, 0.225617, 0.27466, 0.120849, 0.066533, 0.002657, -0.342596, -0.063055, 0.295016, -0.376311, 0.188992, -0.105298, -0.133214, -0.523468, 0.300144, 0.055868, 0.05789, -0.300784, 0.501211, -0.043136, 0.095489, -0.064343, -0.243143, 0.598877, -0.056276, -0.23307, 0.110491, -0.042254, 0.522188, 0.028682, 0.026944, -0.108298], [0.04786, 0.160247, 0.421851, 0.415427, -0.107821, 0.112378, 0.193293, -0.042075, -0.106808, 0.179203, 0.143353, 0.618335, 0.005893, -0.046837, 0.406127, 0.002176, 0.175816, -0.437527, -0.11393, -0.005356, 0.061729, -0.342574, 0.173685, 0.06505, 0.009014, 0.695918, 0.004458, -0.453257, -0.091235, -0.016751, -0.16158, 0.076647, 0.370915, 0.693828, 0.336673, -0.612058, 0.448053, -0.86149, -0.205262, 0.049146, 0.204202, 0.218175, 0.468365, 0.046233, 0.114688, 0.044594, -0.789819, 0.542974, -0.898661, 0.18148, 0.362362, 0.61275, 0.719726, -0.36438, 0.571582, 0.222355, 0.183829, 0.721527, 0.076718, 0.134886, 0.157932, 0.149763, 0.107946, 0.350139, -0.369785, 0.619561, -0.339028, -0.69444, 0.019499, -0.331068, 0.656664, -0.076593, 0.347583, -0.246793, 0.106574, -0.148943, -0.419194, -0.21535, -0.299861, 0.108855, -0.024034, 0.184184, 0.317615, 0.148784, -0.081609, 0.024163, -0.090713, -0.197355, -0.268741, 0.114465, -0.206823, 0.188209, -0.214934, 0.110293, 0.690419, -0.122929, -0.082383, 0.239522, -0.443558, 0.277913, -0.320475, -0.393214, -0.013816, -0.541067, 0.174505, -0.110815, -0.196768, 0.264542, 0.375351, -0.481765, -0.501125, 0.299533, -0.545806, 0.057149, 0.257329, 0.131781, 0.168977, 0.0714, -0.018438, -0.611875, 0.008619, 0.143276, 0.191414, -0.113241, -0.53275, -0.116768, -0.028668, -0.419697, 0.463719, 0.288668, -0.127289, -0.30549, -0.026129, -0.662223, 0.362249, 0.063958, -0.36746, 0.228833, 0.306009, -0.188425, -0.490964, -0.643411, 0.673862, -0.24499, 0.741817, -0.253688, -0.739257, 0.080849, 0.25441, -0.549515, 0.046795, 0.142733, -0.015562, 0.250952, -0.047867, -0.071361, -0.021575, 0.260811, 0.440807, -0.093169, 0.055805, -0.382253, 0.210588, -0.374045, -0.727135, -0.079859, -0.882467, -0.103809, 0.206965, 0.204566, 0.085066, 0.004148, -0.106975, 0.368446, -0.495204, -0.357427, 0.389683, -0.359167, 0.152469, -0.225142, -0.406553, -0.63162, 0.413182, -0.429056, -3.5e-05, -0.150705, 0.63328, 0.206787, 0.122325, -0.591071, -0.193145, 0.572201, -0.060755, -0.371966, -0.529297, -0.076135, 0.216951, -0.125271, 0.519851, 0.058595]]
    }
}

应用场景

  1. 同义词挖掘
  2. 语义搜索
  3. 个性化推荐
  4. 专有名词挖掘
  5. 搜索query改写
  6. NLP downstream tasks

项搜索结果

    空空如也
    没有找到您要搜索的内容,请直接拨打服务热线400-0590-666