• 大小:
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-17
  • 语言: 其他
  • 标签: 深度学习  书籍  

资源简介

deep learning (Bengio大作:深度学习)中文版

资源截图

代码片段和文件信息

#!/usr/bin/env python3
import sys
import re

def create_gls_dict():
    term_file = open(‘../terminology.tex‘ ‘r‘)
    term_file.readline()
    terms = term_file.read()
    term_file.close()
    term_name_dict = {}
    term_symbol_dict = {}
    for term in terms.split(‘\n\n‘):
        tmp = term.strip().split(‘\n‘)
        if tmp[2].strip()[:4] != ‘name‘:
            print(tmp)
        dirty_term = tmp[0][18:]
        term_name_dict[dirty_term[:dirty_term.find(‘}‘)]] = tmp[2].strip()[5:-1]
        for s in tmp:
            if s.strip()[:6] == ‘symbol‘:
                dirty_symbol = s.strip()[8:]
                term_symbol_dict[dirty_term[:dirty_term.find(‘}‘)]] =  dirty_symbol[:dirty_symbol.find(‘}‘)]
                

    return term_name_dict term_symbol_dict


def replace_single_gls(tex p term_dict):
    pl = p.finditer(tex)
    new_tex = ‘‘
    prev_pos = 0
    for i in pl:
        new_tex += tex[prev_pos:i.start()] + term_dict[i.group()[i.group().find(‘{‘)+1:-1]]
        prev_pos = i.end()
    new_tex += tex[prev_pos:]
    return new_tex


def replace_all_gls(input_tex term_name_dict term_symbol_dict):
    # matched \gls{}
    tex_file = open(input_tex ‘r‘)
    tex = tex_file.read()

    p = re.compile(‘\\\\gls\\{[^\\}]*\\}‘)
    tex = replace_single_gls(tex p term_name_dict)

    p = re.compile(‘\\\\firstgls\\{[^\\}]*\\}‘)
    tex = replace_single_gls(tex p term_name_dict)

    p = re.compile(‘\\\\firstall\\{[^\\}]*\\}‘)
    tex = replace_single_gls(tex p term_name_dict)

    p = re.compile(‘\\\\firstacr\\{[^\\}]*\\}‘)
    tex = replace_single_gls(tex p term_name_dict)

    p = re.compile(‘\\\\glsacr\\{[^\\}]*\\}‘)
    tex = replace_single_gls(tex p term_name_dict)

    p = re.compile(‘\\\\glsentrytext\\{[^\\}]*\\}‘)
    tex = replace_single_gls(tex p term_name_dict)

    p = re.compile(‘\\\\glssymbol\\{[^\\}]*\\}‘)
    tex = replace_single_gls(tex p term_symbol_dict)

    return tex

if __name__ == ‘__main__‘:
    input_tex = sys.argv[1]
    term_name_dict term_symbol_dict = create_gls_dict()
    print(replace_all_gls(input_tex term_name_dict term_symbol_dict))
    #print(term_name_dict term_symbol_dict)


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\
     文件         256  2017-02-12 01:25  deeplearningbook-chinese-master\.gitignore
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter1\
     文件          17  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter1\README.md
     文件     1549009  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter1\dlbook_cn_chapter1.pdf
     文件       51618  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter1\introduction.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter10\
     文件          17  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter10\README.md
     文件       97102  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter10\sequence_modeling_rnn.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter11\
     文件          20  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter11\README.md
     文件       49127  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter11\practical_methodology.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter12\
     文件          20  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter12\README.md
     文件      101813  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter12\applications.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter13\
     文件          20  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter13\README.md
     文件       29362  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter13\linear_factor_models.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter14\
     文件          20  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter14\README.md
     文件       50918  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter14\autoencoders.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter15\
     文件          20  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter15\README.md
     文件       75445  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter15\representation_learning.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter16\
     文件          20  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter16\README.md
     文件       76640  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter16\structured_probabilistic_modelling.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter17\
     文件          20  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter17\README.md
     文件       36796  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter17\monte_carlo_methods.tex
     目录           0  2017-02-12 01:25  deeplearningbook-chinese-master\Chapter18\
............此处省略150个文件信息

评论

共有 条评论