[语音识别] 文本加标点--训练BLSTM

2021-07-21 14:49:46 浏览数 (1)

文本加标点--训练BLSTM

bert4keras==0.5.9

代码语言:javascript复制
# -*- coding:utf-8 -*-
import os 
import re
import sys
import time
import jieba
import gensim   
import logging
import numpy as np
import pandas as pd
from tqdm import tqdm
import multiprocessing
from bert4keras.snippets import sequence_padding, DataGenerator
from bert4keras.optimizers import Adam
import warnings
warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim')# 忽略警告
np.random.seed(2019)

import keras
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras.regularizers import l2
from keras.callbacks import *
from keras.optimizers import *
from keras.callbacks import *
from keras import backend as K


# 超参数
batch_size = 32
learning_rate = 0.001
epochs = 50



def load_data(filename1, filename2):
    xlist = np.load('./wikiw2v.npy') 
    ylist = np.load('./wikipunc.npy

0 人点赞