(max_len=512)
:param max_len: 文本最大长度
    :return: 字典形式，key: kb_id  value: kb_id对应描述文本形成的向量
:param max_len: 文本最大长度
    :return: 字典形式，key: kb_id  value: kb_id对应描述文本形成的向量
: param max_len : 文本最大长度 : return : 字典形式，key : kb_id value : kb_id对应描述文本形成的向量
def extract(max_len=512):
    '''
    :param max_len: 文本最大长度
    :return: 字典形式，key: kb_id  value: kb_id对应描述文本形成的向量
    '''
    model = get_model(max_len)
    token_dict = get_token_dict()
    tokenizer = Tokenizer(token_dict)
    id_text=pd.read_pickle('data/id_text.pkl')
    id_embedding={}
    for id in id_text:
        if int(id)%10000==0:
            print(id)
        text=id_text[id]
        indices, segments = tokenizer.encode(first=text,max_len=512)
        predicts = model.predict([[indices], [segments]], verbose=2)
        id_embedding[id]=predicts[0]
    pd.to_pickle(id_embedding,'data/id_embedding.pkl')
def extract ( max_len = 512 ) : model = get_model ( max_len ) token_dict = get_token_dict ( ) tokenizer = Tokenizer ( token_dict ) id_text = pd . read_pickle ( 'data/id_text.pkl' ) id_embedding = { } for id in id_text : if int ( id ) % 10000 == 0 : print ( id ) text = id_text [ id ] indices , segments = tokenizer . encode ( first = text , max_len = 512 ) predicts = model . predict ( [ [ indices ] , [ segments ] ] , verbose = 2 ) id_embedding [ id ] = predicts [ 0 ] pd . to_pickle ( id_embedding , 'data/id_embedding.pkl' )