{"id":19070462,"url":"https://github.com/mindspore-courses/chinese-text-classification-mindspore","last_synced_at":"2025-09-01T09:38:42.877Z","repository":{"id":172344409,"uuid":"648112169","full_name":"mindspore-courses/Chinese-Text-Classification-MindSpore","owner":"mindspore-courses","description":"This repository is used for storing information about MindSpore","archived":false,"fork":false,"pushed_at":"2023-11-06T03:49:43.000Z","size":22528,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-28T14:28:01.193Z","etag":null,"topics":["tutorial"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mindspore-courses.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-01T08:30:23.000Z","updated_at":"2024-11-15T08:14:27.000Z","dependencies_parsed_at":"2024-11-09T01:29:02.888Z","dependency_job_id":null,"html_url":"https://github.com/mindspore-courses/Chinese-Text-Classification-MindSpore","commit_stats":null,"previous_names":["hawkingc/mindsporeintership"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mindspore-courses/Chinese-Text-Classification-MindSpore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-courses%2FChinese-Text-Classification-MindSpore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-courses%2FChinese-Text-Classification-MindSpore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-courses%2FChinese-Text-Classification-MindSpore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-courses%2FChinese-Text-Classification-MindSpore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mindspore-courses","download_url":"https://codeload.github.com/mindspore-courses/Chinese-Text-Classification-MindSpore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindspore-courses%2FChinese-Text-Classification-MindSpore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273100756,"owners_count":25045700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tutorial"],"created_at":"2024-11-09T01:18:47.976Z","updated_at":"2025-09-01T09:38:42.848Z","avatar_url":"https://github.com/mindspore-courses.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chinese-Text-Classification-Mindspore\r\n\r\n\r\n中文文本分类，TextCNN，TextRNN，FastText，TextRCNN，BiLSTM_Attention, DPCNN, Transformer, 基于mindspore，开箱即用。\r\n\r\n## 介绍\r\n\r\n### 声明：\r\n本项目是通过原[Chinese-Text-Classification-Pytorch](https://github.com/649453932/Chinese-Text-Classification-Pytorch)项目针对pytorch进行mindspore框架的模型迁移与训练，旨在让更多感兴趣的人能够上手mindspore并了解、支持mindspore的研发，做出贡献加速mindspore社区成长与完善,欢迎star:star2::blush::two_hearts:\r\n\r\n\r\n### Mindspore： \r\n昇思[MindSpore](https://www.mindspore.cn/)通过社区合作，面向全场景构建最佳昇腾匹配、支持多处理器架构的开放AI架构，为算法工程师和数据科学家提供开发友好、运行高效、部署灵活的体验，帮助人工智能软硬件应用生态繁荣发展。\r\n\r\n数据以字为单位输入模型，预训练词向量使用 [搜狗新闻 Word+Character 300d](https://github.com/Embedding/Chinese-Word-Vectors)，[点这里下载](https://pan.baidu.com/s/14k-9jsspp43ZhMxqPmsWMQ)  \r\n\r\n## 环境\r\npython 3.7  \r\nmindspore 2.0.0 \r\ntqdm  \r\nsklearn  \r\n\r\n\r\n## 中文数据集\r\n从[THUCNews](http://thuctc.thunlp.org/)中抽取了20万条新闻标题，文本长度在20到30之间。一共10个类别，每类2万条。\r\n\r\n类别：财经、房产、股票、教育、科技、社会、时政、体育、游戏、娱乐。\r\n\r\n数据集划分：\r\n\r\n数据集|数据量\r\n--|--\r\n训练集|18万\r\n验证集|1万\r\n测试集|1万\r\n\r\n\r\n### 更换自己的数据集\r\n - 如果用字，按照数据集的格式来格式化你的数据。  \r\n - 如果用词，提前分好词，词之间用空格隔开，`python run.py --model TextCNN --word True`  \r\n - 使用预训练词向量：utils.py的main函数可以提取词表对应的预训练词向量。  \r\n\r\n\r\n\r\n## 使用说明\r\n```\r\n# 训练并测试：\r\n# TextCNN\r\npython run.py --model TextCNN\r\n\r\n# TextRNN\r\npython run.py --model TextRNN\r\n\r\n# TextRNN_Att\r\npython run.py --model TextRNN_Att\r\n\r\n# TextRCNN\r\npython run.py --model TextRCNN\r\n\r\n# FastText, embedding层是随机初始化的\r\npython run.py --model FastText --embedding random \r\n\r\n# DPCNN\r\npython run.py --model DPCNN\r\n\r\n# Transformer\r\npython run.py --model Transformer\r\n```\r\n\r\n### 参数\r\n模型都在models目录下，超参定义和模型定义在同一文件中。  \r\n\r\n\r\n### API对应及出处\r\n[PyTorch与MindSpore API映射表](https://www.mindspore.cn/docs/zh-CN/r2.0.0-alpha/note/api_mapping/pytorch_api_mapping.html)\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindspore-courses%2Fchinese-text-classification-mindspore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindspore-courses%2Fchinese-text-classification-mindspore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindspore-courses%2Fchinese-text-classification-mindspore/lists"}