当前位置: 代码迷 >> 综合 >> bert 文本分类 这个绝对没有一点错误
  详细解决方案

bert 文本分类 这个绝对没有一点错误

热度:24   发布时间:2023-12-26 09:18:33.0

链接:https://pan.baidu.com/s/1UDO_uqX2q8CmIoxrRKJO5A 

链接:https://pan.baidu.com/s/1nW0tqk1HIXZK9rr-VmnpIQ 
提取码:身份证后四位   me v 18340082396
复制这段内容后打开百度网盘手机App,操作更方便哦

import torch
from torch import nn
from torch import optim
import transformers as tfs
import math
import numpy as np
import pandas as pd
from sklearn.metrics import f1_score
import warnings
import re
import jieba
warnings.filterwarnings('ignore')
from tqdm import tqdm
from sklearn.model_selection import train_test_splitdata = pd.read_excel('淮安评论合集.xlsx')
train_data=data["comment"]
train_label=data["sentiment"]
print(train_data.values)
print(train_label.values)juzi=[]
for i in train_data:zifuchuan=""
#     print(re.findall('[\u4E00-\u9FA5\\s]',i))for ii in re.findall('[\u4E00-\u9FA5\\s]',i):zifuchuan=zifuchuan+str(ii)zifuchuan=zifuchuan.replace("
  相关解决方案