作家
登录

漫谈四种神经网络序列解码模型以及示例代码

作者: 来源: 2017-04-25 13:04:28 阅读 我要评论

  •     for s_index, tar_tmp in enumerate(tar_list):    
  •         for t_index, token in enumerate(tar_tmp):    
  •             Y[s_index, t_index, word_idx[token]] = 1    
  •   
  •     return pad_sequences(x_set, maxlen=input_maxlen), Y    
  •   
  •   
  • def tokenize(sent):    
  •     ”’Return the tokens of a sentence including punctuation. 
  •   
  •     >>> tokenize(‘Bob dropped the apple. Where is the apple?’)   
  •     ['Bob''dropped''the''apple''.''Where''is''the''apple''?']   
  •     ”’   
  •     return [x.strip() for x in re.split('(\W )?', sent) if x.strip()]    
  •   
  •   
  • def main():    
  •     input_text = ['1 2 3 4 5'    
  •                   , '6 7 8 9 10'    
  •                   , '11 12 13 14 15'    
  •                   , '16 17 18 19 20'    
  •                   , '21 22 23 24 25']    
  •     tar_text = ['one two three four five'    
  •                 , 'six seven eight nine ten'    
  •                 , 'eleven twelve thirteen fourteen fifteen'    
  •                 , 'sixteen seventeen eighteen nineteen twenty'    

  •   推荐阅读

      如何使用batch-import工具向neo4j中导入海量数据

    【引自T_SevenS的博客】在开辟neo4j的过程中,经常会有同窗问若何向neo4j中导入大年夜量的汗青数据,而这些数据一般都邑存在于关系型数据库中,如今本人就根据本身的导入经历,把导入的过>>>详细阅读


    本文标题:漫谈四种神经网络序列解码模型以及示例代码

    地址:http://www.17bianji.com/lsqh/34942.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)