How to use the text2vec.encode function in text2vec

To help you get started, we’ve selected a few text2vec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shibing624 / text2vec / examples / base_demo.py View on Github external
# -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description: 
"""

import numpy as np

import text2vec

text2vec.set_log_level('DEBUG')

char = '我'
result = text2vec.encode(char)
print(type(result))
print(char, result)

word = '如何'
print(word, text2vec.encode(word))

a = '如何更换花呗绑定银行卡'
emb = text2vec.encode(a)
print(a, emb)

b = ['我',
     '如何',
     '如何更换花呗绑定银行卡',
     '如何更换花呗绑定银行卡,如何更换花呗绑定银行卡。如何更换花呗绑定银行卡?。。。这个,如何更换花呗绑定银行卡!']
result = []
for i in b:
github shibing624 / text2vec / examples / base_demo.py View on Github external
import numpy as np

import text2vec

text2vec.set_log_level('DEBUG')

char = '我'
result = text2vec.encode(char)
print(type(result))
print(char, result)

word = '如何'
print(word, text2vec.encode(word))

a = '如何更换花呗绑定银行卡'
emb = text2vec.encode(a)
print(a, emb)

b = ['我',
     '如何',
     '如何更换花呗绑定银行卡',
     '如何更换花呗绑定银行卡,如何更换花呗绑定银行卡。如何更换花呗绑定银行卡?。。。这个,如何更换花呗绑定银行卡!']
result = []
for i in b:
    r = text2vec.encode(i)
    result.append(r)
print(b, result)

print(np.array(result).shape)
github shibing624 / text2vec / examples / base_demo.py View on Github external
@description: 
"""

import numpy as np

import text2vec

text2vec.set_log_level('DEBUG')

char = '我'
result = text2vec.encode(char)
print(type(result))
print(char, result)

word = '如何'
print(word, text2vec.encode(word))

a = '如何更换花呗绑定银行卡'
emb = text2vec.encode(a)
print(a, emb)

b = ['我',
     '如何',
     '如何更换花呗绑定银行卡',
     '如何更换花呗绑定银行卡,如何更换花呗绑定银行卡。如何更换花呗绑定银行卡?。。。这个,如何更换花呗绑定银行卡!']
result = []
for i in b:
    r = text2vec.encode(i)
    result.append(r)
print(b, result)

print(np.array(result).shape)
github shibing624 / text2vec / examples / base_demo.py View on Github external
print(char, result)

word = '如何'
print(word, text2vec.encode(word))

a = '如何更换花呗绑定银行卡'
emb = text2vec.encode(a)
print(a, emb)

b = ['我',
     '如何',
     '如何更换花呗绑定银行卡',
     '如何更换花呗绑定银行卡,如何更换花呗绑定银行卡。如何更换花呗绑定银行卡?。。。这个,如何更换花呗绑定银行卡!']
result = []
for i in b:
    r = text2vec.encode(i)
    result.append(r)
print(b, result)

print(np.array(result).shape)