讯飞汽车领域多语种迁移学习 打卡博客

任务1:报名比赛

  • 步骤1:报名比赛2022 iFLYTEK A.I.开发者大赛-讯飞开放平台
  • 步骤2:下载比赛数据(点击比赛页面的赛题数据)
  • 步骤3:解压比赛数据,并使用pandas进行读取;
  • 步骤4:查看训练集和测试集字段类型,并将数据读取代码写到博客;
import pandas as pd
import numpy as np


#任务一:读取数据
train_cn = pd.read_excel('data/中文_train.xlsx')
train_en = pd.read_excel('data/英文_train.xlsx')
train_jp = pd.read_excel('data/日语_train.xlsx')
test_jp = pd.read_excel('data/test_A.xlsx', sheet_name='日语_testA')
test_en = pd.read_excel('data/test_A.xlsx', sheet_name='英文_testA')
#查看数据
print(train_cn.head())
原始文本意图槽值1槽值2
016.5度adjust_ac_temperature_to_numberoffset:16.5NaN
116度adjust_ac_temperature_to_numberoffset:16NaN
216空调开到16度adjust_ac_temperature_to_numberoffset:16NaN
316温度16度adjust_ac_temperature_to_numberoffset:16NaN
417度adjust_ac_temperature_to_numberoffset:17NaN
print(train_en.head())
原始文本中文翻译意图槽值1槽值2
0open aircon please请打开空调open_acNANNAN
1I want to activate the AC我想打开空调open_acNANNAN
2I want to turn on the air conditioner我想打开空调open_acNANNAN
3switch on the AC please请打开空调open_acNANNAN
4Help me open the AC帮我打开空调open_acNANNAN
print(train_jp.head())
原始文本中文翻译意图槽值1槽值2
0エアコンのスイッチONに打开空调开关open_acNANNAN
1エアコン入れる打开空调open_acNANNAN
2エアコンのスイッチを打开空调开关open_acNANNAN
3エアコンのスイッチ入れる打开空调开关open_acNANNAN
4エアコンのスイッチON打开空调开关open_acNANNAN
#查看测试集数据
print(test_jp.head())
print(test_en.head())
原始文本
0switch on the AC
1air conditioner open
2Turn on the AC please
3I wanna switch on aircon please
4Help me switch on aircon

任务2:文本分析与文本分词

  • 步骤1:使用jieba对中文进行分词;
    import jieba
    
    
    def cutwords(txt):
        return jieba.lcut(txt)
    
    
    train_cn['phrase'] = train_cn['原始文本'].apply(cutwords)
    print(train_cn.head())

    lcut 将返回的对象转化为list对象返回

  • 步骤2:使用negisa对日语进行分词
    import nagisa
    def cutjpwords(txt):
        words = nagisa.tagging(txt)
        return words.words
    
    
    train_jp['phrase'] = train_jp['原始文本'].apply(cutjpwords)
    
    print(train_jp.head())

     

  • 任务3:TFIDF与文本分类

    • 步骤1:学习TFIDF的使用,提取语料的TFIDF特征;
    • 步骤2:使用逻辑回归结合TFIDF进行训练(所有的语言语料),并对测试集的意图进行分类;
    • 步骤3:将步骤2预测的结果文件提交到比赛,截图分数;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值