[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-ShawnyXiao--TextClassification-Keras":3,"tool-ShawnyXiao--TextClassification-Keras":64},[4,17,25,39,48,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,14,15],"开发框架","Agent","语言模型","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":10,"last_commit_at":23,"category_tags":24,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,15],{"id":26,"name":27,"github_repo":28,"description_zh":29,"stars":30,"difficulty_score":10,"last_commit_at":31,"category_tags":32,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[33,34,35,36,14,37,15,13,38],"图像","数据工具","视频","插件","其他","音频",{"id":40,"name":41,"github_repo":42,"description_zh":43,"stars":44,"difficulty_score":45,"last_commit_at":46,"category_tags":47,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,3,"2026-04-04T04:44:48",[14,33,13,15,37],{"id":49,"name":50,"github_repo":51,"description_zh":52,"stars":53,"difficulty_score":45,"last_commit_at":54,"category_tags":55,"status":16},519,"PaddleOCR","PaddlePaddle\u002FPaddleOCR","PaddleOCR 是一款基于百度飞桨框架开发的高性能开源光学字符识别工具包。它的核心能力是将图片、PDF 等文档中的文字提取出来，转换成计算机可读取的结构化数据，让机器真正“看懂”图文内容。\n\n面对海量纸质或电子文档，PaddleOCR 解决了人工录入效率低、数字化成本高的问题。尤其在人工智能领域，它扮演着连接图像与大型语言模型（LLM）的桥梁角色，能将视觉信息直接转化为文本输入，助力智能问答、文档分析等应用场景落地。\n\nPaddleOCR 适合开发者、算法研究人员以及有文档自动化需求的普通用户。其技术优势十分明显：不仅支持全球 100 多种语言的识别，还能在 Windows、Linux、macOS 等多个系统上运行，并灵活适配 CPU、GPU、NPU 等各类硬件。作为一个轻量级且社区活跃的开源项目，PaddleOCR 既能满足快速集成的需求，也能支撑前沿的视觉语言研究，是处理文字识别任务的理想选择。",74913,"2026-04-05T10:44:17",[15,33,13,37],{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":45,"last_commit_at":62,"category_tags":63,"status":16},2181,"OpenHands","OpenHands\u002FOpenHands","OpenHands 是一个专注于 AI 驱动开发的开源平台，旨在让智能体（Agent）像人类开发者一样理解、编写和调试代码。它解决了传统编程中重复性劳动多、环境配置复杂以及人机协作效率低等痛点，通过自动化流程显著提升开发速度。\n\n无论是希望提升编码效率的软件工程师、探索智能体技术的研究人员，还是需要快速原型验证的技术团队，都能从中受益。OpenHands 提供了灵活多样的使用方式：既可以通过命令行（CLI）或本地图形界面在个人电脑上轻松上手，体验类似 Devin 的流畅交互；也能利用其强大的 Python SDK 自定义智能体逻辑，甚至在云端大规模部署上千个智能体并行工作。\n\n其核心技术亮点在于模块化的软件智能体 SDK，这不仅构成了平台的引擎，还支持高度可组合的开发模式。此外，OpenHands 在 SWE-bench 基准测试中取得了 77.6% 的优异成绩，证明了其解决真实世界软件工程问题的能力。平台还具备完善的企业级功能，支持与 Slack、Jira 等工具集成，并提供细粒度的权限管理，适合从个人开发者到大型企业的各类用户场景。",70612,"2026-04-05T11:12:22",[15,14,13,36],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":80,"owner_email":81,"owner_twitter":82,"owner_website":83,"owner_url":84,"languages":85,"stars":90,"forks":91,"last_commit_at":92,"license":93,"difficulty_score":10,"env_os":94,"env_gpu":95,"env_ram":95,"env_deps":96,"category_tags":102,"github_topics":103,"view_count":10,"oss_zip_url":82,"oss_zip_packed_at":82,"status":16,"created_at":112,"updated_at":113,"faqs":114,"releases":115},1415,"ShawnyXiao\u002FTextClassification-Keras","TextClassification-Keras","Text classification models implemented in Keras, including: FastText, TextCNN, TextRNN, TextBiRNN, TextAttBiRNN, HAN, RCNN, RCNNVariant, etc.","TextClassification-Keras 是一个基于 Keras 框架打造的深度学习文本分类模型库，旨在为开发者提供一套开箱即用的经典算法实现。它有效解决了在自然语言处理任务中，从零构建和复现复杂神经网络结构耗时费力的问题，让用户能专注于数据与业务逻辑。\n\n该工具非常适合人工智能开发者、算法研究人员以及希望快速验证文本分类方案的技术团队使用。其核心亮点在于集成了多种业界主流的文本分类架构，包括高效的 FastText、擅长提取局部特征的 TextCNN、处理序列信息的 TextRNN 及其双向变体（TextBiRNN），还涵盖了引入注意力机制的 TextAttBiRNN、层级网络 HAN 以及递归卷积网络 RCNN 等进阶模型。\n\n除了提供清晰的模型代码实现外，TextClassification-Keras 还为每种模型配备了简化的应用示例，帮助用户快速理解网络结构与运行流程。项目基于 Python 3.7 与 TensorFlow 2.0 环境构建，代码结构清晰，文档详尽，是学习和实践深度学习文本分类技术的优质资源。","# TextClassification-Keras\n\nThis code repository implements a variety of **deep learning models** for **text classification** using the **Keras** framework, which includes: **FastText**, **TextCNN**, **TextRNN**, **TextBiRNN**, **TextAttBiRNN**, **HAN**, **RCNN**, **RCNNVariant**, etc. In addition to the model implementation, a simplified application is included.\n\n- [English documents](README.md)\n- [中文文档](README-ZH.md)\n\n## Guidance\n\n1. [Environment](#environment)\n2. [Usage](#usage)\n3. [Model](#model)\n    1. [FastText](#1-fasttext)\n    2. [TextCNN](#2-textcnn)\n    3. [TextRNN](#3-textrnn)\n    4. [TextBiRNN](#4-textbirnn)\n    5. [TextAttBiRNN](#5-textattbirnn)\n    6. [HAN](#6-han)\n    7. [RCNN](#7-rcnn)\n    8. [RCNNVariant](#8-rcnnvariant)\n    999. [To Be Continued...](#to-be-continued)\n4. [Reference](#reference)\n\n## Environment\n\n- Python 3.7\n- NumPy 1.17.2\n- Tensorflow 2.0.1\n\n## Usage\n\nAll codes are located in the directory ```\u002Fmodel```, and each kind of model has a corresponding directory in which the model and application are placed.\n\nFor example, the model and application of FastText are located under ```\u002Fmodel\u002FFastText```, the model part is ```fast_text.py```, and the application part is ```main.py```.\n\n## Model\n\n### 1 FastText\n\nFastText was proposed in the paper [Bag of Tricks for Efficient Text Classification](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1607.01759.pdf).\n\n#### 1.1 Description in Paper\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_bbb298d74fc2.png\">\n\u003C\u002Fp>\n\n1.\tUsing a look-up table, **bags of ngram** covert to **word representations**.\n2.\tWord representations are **averaged** into a text representation, which is a hidden variable.\n3.\tText representation is in turn fed to a **linear classifier**.\n4.\tUse the **softmax** function to compute the probability distribution over the predefined classes.\n\n#### 1.2 Implementation Here\n\nNetwork structure of FastText:\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_2b8dae1c1dce.png\">\n\u003C\u002Fp>\n\n### 2 TextCNN\n\nTextCNN was proposed in the paper [Convolutional Neural Networks for Sentence Classification](http:\u002F\u002Fwww.aclweb.org\u002Fanthology\u002FD14-1181).\n\n#### 2.1 Description in Paper\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_3d15be21bd66.png\">\n\u003C\u002Fp>\n\n1. Represent sentence with **static and non-static channels**.\n2. **Convolve** with multiple filter widths and feature maps.\n3. Use **max-over-time pooling**.\n4. Use **fully connected layer** with **dropout** and **softmax** ouput.\n\n#### 2.2 Implementation Here\n\nNetwork structure of TextCNN:\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_cbdb7b009d6c.png\">\n\u003C\u002Fp>\n\n### 3 TextRNN\n\nTextRNN has been mentioned in the paper [Recurrent Neural Network for Text Classification with Multi-Task Learning](https:\u002F\u002Fwww.ijcai.org\u002FProceedings\u002F16\u002FPapers\u002F408.pdf).\n\n#### 3.1 Description in Paper\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_e998b75d1eda.png\">\n\u003C\u002Fp>\n\n#### 3.2 Implementation Here\n\nNetwork structure of TextRNN:\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_5a50d27d0806.png\">\n\u003C\u002Fp>\n\n### 4 TextBiRNN\n\nTextBiRNN is an improved model based on TextRNN. It improves the RNN layer in the network structure into a bidirectional RNN layer. It is hoped that not only the forward encoding information but also the reverse encoding information can be considered. No related papers have been found yet.\n\nNetwork structure of TextBiRNN:\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_43f9eba19eea.png\">\n\u003C\u002Fp>\n\n### 5 TextAttBiRNN\n\nTextAttBiRNN is an improved model which introduces attention mechanism based on TextBiRNN. For the representation vectors obtained by bidirectional RNN encoder, the model can focus on the information most relevant to decision making through the attention mechanism. The attention mechanism was first proposed in the paper [Neural Machine Translation by Jointly Learning to Align and Translate](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1409.0473.pdf), and the implementation of the attention mechanism here is referred to this paper [Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1512.08756.pdf).\n\n#### 5.1 Description in Paper\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_5178e95864f8.png\">\n\u003C\u002Fp>\n\nIn the paper [Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1512.08756.pdf), the **feed forward attention** is simplified as follows,\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_2c1c0f24e5d2.png\">\n\u003C\u002Fp>\n\nFunction `a`, a learnable function, is recognized as a **feed forward network**. In this formulation, attention can be seen as producing a fixed-length embedding `c` of the input sequence by computing an **adaptive weighted average** of the state sequence `h`.\n\n#### 5.2 Implementation Here\n\nThe implementation of attention is not described here, please refer to the source code directly.\n\nNetwork structure of TextAttBiRNN:\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_0309d9b6bc0b.png\">\n\u003C\u002Fp>\n\n### 6 HAN\n\nHAN was proposed in the paper [Hierarchical Attention Networks for Document Classification](http:\u002F\u002Fwww.aclweb.org\u002Fanthology\u002FN16-1174).\n\n#### 6.1 Description in Paper\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_36c329d01c35.png\">\n\u003C\u002Fp>\n\n1. **Word Encoder**. Encoding by **bidirectional GRU**, an annotation for a given word is obtained by concatenating the forward hidden state and backward hidden state, which summarizes the information of the whole sentence centered around word in current time step.\n2. **Word Attention**. By a one-layer **MLP** and softmax function, it is enable to calculate normalized importance weights over the previous word annotations. Then, compute the sentence vector as a **weighted sum** of the word annotations based on the weights.\n3. **Sentence Encoder**. In a similar way with word encoder, use a **bidirectional GRU** to encode the sentences to get an annotation for a sentence.\n4. **Sentence Attention**. Similar with word attention, use a one-layer **MLP** and softmax function to get the weights over sentence annotations. Then, calculate a **weighted sum** of the sentence annotations based on the weights to get the document vector.\n5. **Document Classification**. Use the **softmax** function to calculate the probability of all classes.\n\n#### 6.2 Implementation Here\n\nThe implementation of attention here is based on FeedForwardAttention, which is the same as the attention in TextAttBiRNN.\n\nNetwork structure of HAN:\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_055073bde226.png\">\n\u003C\u002Fp>\n\nThe TimeDistributed wrapper is used here, since the parameters of the Embedding, Bidirectional RNN, and Attention layers are expected to be shared on the time step dimension.\n\n### 7 RCNN\n\nRCNN was proposed in the paper [Recurrent Convolutional Neural Networks for Text Classification](https:\u002F\u002Fwww.aaai.org\u002Focs\u002Findex.php\u002FAAAI\u002FAAAI15\u002Fpaper\u002Fview\u002F9745\u002F9552).\n\n#### 7.1 Description in Paper\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_1ff27fd77e1d.png\">\n\u003C\u002Fp>\n\n1. **Word Representation Learning**. RCNN uses a recurrent structure, which is a **bi-directional recurrent neural network**, to capture the contexts. Then, combine the word and its context to present the word. And apply a **linear transformation** together with the `tanh` activation fucntion to the representation.\n2. **Text Representation Learning**. When all of the representations of words are calculated, it applys a element-wise **max-pooling** layer in order to capture the most important information throughout the entire text. Finally, do the **linear transformation** and apply the **softmax** function.\n\n#### 7.2 Implementation Here\n\nNetwork structure of RCNN:\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_d8f6d9e56d93.png\">\n\u003C\u002Fp>\n\n### 8 RCNNVariant\n\nRCNNVariant is an improved model based on RCNN with the following improvements. No related papers have been found yet.\n\n1. The three inputs are changed to **single input**. The input of the left and right contexts is removed.\n2. Use **bidirectional LSTM\u002FGRU** instead of traditional RNN for encoding context.\n3. Use **multi-channel CNN** to represent the semantic vectors. \n4. Replace the Tanh activation layer with the **ReLU activation layer**.\n5. Use both **AveragePooling** and **MaxPooling**.\n\nNetwork structure of RCNNVariant:\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_910332b9cc38.png\">\n\u003C\u002Fp>\n\n### To Be Continued...\n\n## Reference\n\n1. [Bag of Tricks for Efficient Text Classification](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1607.01759.pdf)\n2. [Keras Example IMDB FastText](https:\u002F\u002Fgithub.com\u002Fkeras-team\u002Fkeras\u002Fblob\u002Fmaster\u002Fexamples\u002Fimdb_fasttext.py)\n3. [Convolutional Neural Networks for Sentence Classification](http:\u002F\u002Fwww.aclweb.org\u002Fanthology\u002FD14-1181)\n4. [Keras Example IMDB CNN](https:\u002F\u002Fgithub.com\u002Fkeras-team\u002Fkeras\u002Fblob\u002Fmaster\u002Fexamples\u002Fimdb_cnn.py)\n5. [Recurrent Neural Network for Text Classification with Multi-Task Learning](https:\u002F\u002Fwww.ijcai.org\u002FProceedings\u002F16\u002FPapers\u002F408.pdf)\n6. [Neural Machine Translation by Jointly Learning to Align and Translate](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1409.0473.pdf)\n7. [Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1512.08756.pdf)\n8. [cbaziotis's Attention](https:\u002F\u002Fgist.github.com\u002Fcbaziotis\u002F6428df359af27d58078ca5ed9792bd6d)\n9. [Hierarchical Attention Networks for Document Classification](http:\u002F\u002Fwww.aclweb.org\u002Fanthology\u002FN16-1174)\n10. [Richard's HAN](https:\u002F\u002Frichliao.github.io\u002Fsupervised\u002Fclassification\u002F2016\u002F12\u002F26\u002Ftextclassifier-HATN\u002F)\n11. [Recurrent Convolutional Neural Networks for Text Classification](https:\u002F\u002Fwww.aaai.org\u002Focs\u002Findex.php\u002FAAAI\u002FAAAI15\u002Fpaper\u002Fview\u002F9745\u002F9552)\n12. [airalcorn2's RCNN](https:\u002F\u002Fgithub.com\u002Fairalcorn2\u002FRecurrent-Convolutional-Neural-Network-Text-Classifier)","# 文本分类-Keras\n\n本代码仓库采用 Keras 框架，实现了多种用于文本分类的**深度学习模型**，包括但不限于：**FastText**、**TextCNN**、**TextRNN**、**TextBiRNN**、**TextAttBiRNN**、**HAN**、**RCNN**、**RCNNVariant** 等。除了模型实现之外，还附带了一个简化的应用示例。\n\n- [英文文档](README.md)\n- [中文文档](README-ZH.md)\n\n## 指导说明\n\n1. [环境设置](#environment)\n2. [使用方法](#usage)\n3. [模型](#model)\n    1. [FastText](#1-fasttext)\n    2. [TextCNN](#2-textcnn)\n    3. [TextRNN](#3-textrnn)\n    4. [TextBiRNN](#4-textbirnn)\n    5. [TextAttBiRNN](#5-textattbirnn)\n    6. [HAN](#6-han)\n    7. [RCNN](#7-rcnn)\n    8. [RCNNVariant](#8-rcnnvariant)\n    999. [待续...](#to-be-continued)\n4. [参考文献](#reference)\n\n## 环境设置\n\n- Python 3.7\n- NumPy 1.17.2\n- TensorFlow 2.0.1\n\n## 使用方法\n\n所有代码均位于目录 `\u002Fmodel` 中，每种模型都对应一个独立的目录，其中分别存放模型文件和应用程序。\n\n例如，FastText 的模型与应用程序位于 `\u002Fmodel\u002FFastText` 目录下，模型部分为 `fast_text.py`，应用程序部分为 `main.py`。\n\n## 模型\n\n### 1 FastText\n\nFastText 是由论文《高效文本分类的“技巧袋”》（[Bag of Tricks for Efficient Text Classification](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1607.01759.pdf)）提出。\n\n#### 1.1 论文中的描述\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_bbb298d74fc2.png\">\n\u003C\u002Fp>\n\n1. 利用查找表，将**ngram 袋**转换为**词表示**。\n2. 将词表示通过**平均**处理，生成文本表示，即隐藏变量。\n3. 将文本表示输入到**线性分类器**中。\n4. 通过**softmax**函数计算预定义类别之间的概率分布。\n\n#### 1.2 本代码中的实现\n\nFastText 的网络结构如下：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_2b8dae1c1dce.png\">\n\u003C\u002Fp>\n\n### 2 TextCNN\n\nTextCNN 是由论文《用于句子分类的卷积神经网络》（[Convolutional Neural Networks for Sentence Classification](http:\u002F\u002Fwww.aclweb.org\u002Fanthology\u002FD14-1181)）提出。\n\n#### 2.1 论文中的描述\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_3d15be21bd66.png\">\n\u003C\u002Fp>\n\n1. 以**静态通道与非静态通道**来表示句子。\n2. 对多个滤波器宽度和特征图进行**卷积操作**。\n3. 使用**时间最大池化**。\n4. 通过**全连接层**结合**Dropout**和**Softmax**输出。\n\n#### 2.2 本代码中的实现\n\nTextCNN 的网络结构如下：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_cbdb7b009d6c.png\">\n\u003C\u002Fp>\n\n### 3 TextRNN\n\nTextRNN 在论文《基于多任务学习的文本分类递归神经网络》（[Recurrent Neural Network for Text Classification with Multi-Task Learning](https:\u002F\u002Fwww.ijcai.org\u002FProceedings\u002F16\u002FPapers\u002F408.pdf)）中被提及。\n\n#### 3.1 论文中的描述\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_e998b75d1eda.png\">\n\u003C\u002Fp>\n\n#### 3.2 本代码中的实现\n\nTextRNN 的网络结构如下：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_5a50d27d0806.png\">\n\u003C\u002Fp>\n\n### 4 TextBiRNN\n\nTextBiRNN 是基于 TextRNN 的改进模型。它将网络结构中的 RNN 层优化为双向 RNN 层，旨在不仅考虑正向编码信息，还能兼顾反向编码信息。目前尚未找到相关论文。\n\nTextBiRNN 的网络结构如下：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_43f9eba19eea.png\">\n\u003C\u002Fp>\n\n### 5 TextAttBiRNN\n\nTextAttBiRNN 是一种基于 TextBiRNN 的改进模型，引入了注意力机制。对于双向 RNN 编码器所得到的表示向量，该模型可通过注意力机制聚焦于对决策最为关键的信息。注意力机制最早由论文《通过联合学习对齐与翻译实现神经机器翻译》（[Neural Machine Translation by Jointly Learning to Align and Translate](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1409.0473.pdf)）提出，而本代码中注意力机制的实现正是参考了该论文《带有注意力的前馈网络可以解决一些长期记忆问题》（[Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1512.08756.pdf)）。\n\n#### 5.1 论文中的描述\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_5178e95864f8.png\">\n\u003C\u002Fp>\n\n在论文《带有注意力的前馈网络可以解决一些长期记忆问题》（[Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1512.08756.pdf)）中，**前馈注意力**被简化为以下形式：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_2c1c0f24e5d2.png\">\n\u003C\u002Fp>\n\n函数 `a` 是一个可学习的函数，被视作**前馈网络**。在此公式中，注意力可以通过对状态序列 `h` 进行**自适应加权平均**，从而生成输入序列的固定长度嵌入向量 `c`。\n\n#### 5.2 本代码中的实现\n\n此处未详细描述注意力机制的实现，建议直接参考源代码。\n\nTextAttBiRNN 的网络结构如下：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_0309d9b6bc0b.png\">\n\u003C\u002Fp>\n\n### 6 HAN\n\nHAN 是由论文《用于文档分类的分层注意力网络》（[Hierarchical Attention Networks for Document Classification](http:\u002F\u002Fwww.aclweb.org\u002Fanthology\u002FN16-1174)）提出。\n\n#### 6.1 论文中的描述\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_36c329d01c35.png\">\n\u003C\u002Fp>\n\n1. **词编码器**：通过**双向 GRU**进行编码，通过对前向隐藏状态与后向隐藏状态进行拼接，获得给定词的标注，从而汇总整个句子的信息，并以当前时间步的词为中心进行总结。\n2. **词注意力**：通过单层**MLP**和 softmax 函数，能够计算出先前词标注的归一化重要权重。随后，根据这些权重，将词标注进行**加权求和**，得到句子向量。\n3. **句编码器**：与词编码器类似，同样使用**双向 GRU**对句子进行编码，以获取句子的标注。\n4. **句注意力**：与词注意力类似，通过单层**MLP**和 softmax 函数，计算出句标注的权重。随后，依据这些权重，对句标注进行**加权求和**，得到文档向量。\n5. **文档分类**：通过**softmax**函数，计算出所有类别的概率。\n\n#### 6.2 本代码中的实现\n\n本代码中注意力机制的实现基于 FeedForwardAttention，与 TextAttBiRNN 中的注意力机制相同。\n\nHAN 的网络结构如下：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_055073bde226.png\">\n\u003C\u002Fp>\n\n这里采用了 TimeDistributed 包装器，因为 Embedding、双向 RNN 和注意力层的参数预计需要在时间步维度上进行共享。\n\n### 7 RCNN\n\nRCNN 是在论文【用于文本分类的递归卷积神经网络】（https:\u002F\u002Fwww.aaai.org\u002Focs\u002Findex.php\u002FAAAI\u002FAAAI15\u002Fpaper\u002Fview\u002F9745\u002F9552）中提出的。\n\n#### 7.1 论文中的描述\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_1ff27fd77e1d.png\">\n\u003C\u002Fp>\n\n1. **词表示学习**。RCNN 采用递归结构——一种**双向递归神经网络**——来捕捉词的上下文信息。随后，将词及其上下文结合起来，形成完整的词表示，并通过**线性变换**与 `tanh` 激活函数相结合，对表示进行处理。\n2. **文本表示学习**。当所有词的表示都计算完毕后，会应用一个逐元素**最大池化**层，以捕捉整段文本中最为重要的信息。最后，再进行**线性变换**并应用**softmax**函数。\n\n#### 7.2 实现方式\n\nRCNN 的网络结构如下：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_d8f6d9e56d93.png\">\n\u003C\u002Fp>\n\n### 8 RCNN 变体\n\nRCNN 变体是在 RCNN 基础上进行改进的模型，其主要改进点如下。目前尚未找到相关论文。\n\n1. 将三个输入改为**单个输入**，去除了左右上下文的输入。\n2. 使用**双向 LSTM\u002FGRU** 替代传统的 RNN 来编码上下文信息。\n3. 采用**多通道 CNN** 来表示语义向量。\n4. 将 Tanh 激活层替换为**ReLU 激活层**。\n5. 同时使用**平均池化**和**最大池化**。\n\nRCNN 变体的网络结构如下：\n\n\u003Cp align=\"center\">\n\t\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_readme_910332b9cc38.png\">\n\u003C\u002Fp>\n\n### 待续...\n\n## 参考文献\n\n1. 【高效文本分类的“妙招”集锦】（https:\u002F\u002Farxiv.org\u002Fpdf\u002F1607.01759.pdf）\n2. 【Keras 示例：IMDB FastText】（https:\u002F\u002Fgithub.com\u002Fkeras-team\u002Fkeras\u002Fblob\u002Fmaster\u002Fexamples\u002Fimdb_fasttext.py）\n3. 【用于句子分类的卷积神经网络】（http:\u002F\u002Fwww.aclweb.org\u002Fanthology\u002FD14-1181）\n4. 【Keras 示例：IMDB CNN】（https:\u002F\u002Fgithub.com\u002Fkeras-team\u002Fkeras\u002Fblob\u002Fmaster\u002Fexamples\u002Fimdb_cnn.py）\n5. 【结合多任务学习的文本分类递归神经网络】（https:\u002F\u002Fwww.ijcai.org\u002FProceedings\u002F16\u002FPapers\u002F408.pdf）\n6. 【通过联合学习对齐与翻译实现神经机器翻译】（https:\u002F\u002Farxiv.org\u002Fpdf\u002F1409.0473.pdf）\n7. 【具有注意力机制的前馈神经网络能够解决部分长期记忆问题】（https:\u002F\u002Farxiv.org\u002Fpdf\u002F1512.08756.pdf）\n8. 【cbaziotis 的注意力机制】（https:\u002F\u002Fgist.github.com\u002Fcbaziotis\u002F6428df359af27d58078ca5ed9792bd6d）\n9. 【用于文档分类的分层注意力网络】（http:\u002F\u002Fwww.aclweb.org\u002Fanthology\u002FN16-1174）\n10. 【Richard 的 HAN 网络】（https:\u002F\u002Frichliao.github.io\u002Fsupervised\u002Fclassification\u002F2016\u002F12\u002F26\u002Ftextclassifier-HATN）\n11. 【用于文本分类的递归卷积神经网络】（https:\u002F\u002Fwww.aaai.org\u002Focs\u002Findex.php\u002FAAAI\u002FAAAI15\u002Fpaper\u002Fview\u002F9745\u002F9552）\n12. 【airalcorn2 的 RCNN】（https:\u002F\u002Fgithub.com\u002Fairalcorn2\u002FRecurrent-Convolutional-Neural-Network-Text-Classifier）","# TextClassification-Keras 快速上手指南\n\n本指南帮助开发者快速部署并使用 TextClassification-Keras 项目进行文本分类任务。该项目基于 Keras (TensorFlow 2.0) 实现了 FastText、TextCNN、TextRNN、HAN 等多种主流深度学习模型。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: Linux \u002F macOS \u002F Windows\n*   **Python 版本**: 3.7\n*   **核心依赖**:\n    *   NumPy 1.17.2\n    *   TensorFlow 2.0.1\n\n> **国内加速建议**：推荐使用清华或阿里镜像源安装依赖，以提升下载速度。\n\n## 安装步骤\n\n1.  **克隆项目代码**\n    ```bash\n    git clone https:\u002F\u002Fgithub.com\u002Fyour-repo\u002FTextClassification-Keras.git\n    cd TextClassification-Keras\n    ```\n\n2.  **安装依赖包**\n    建议使用虚拟环境，并使用国内镜像源安装指定版本的依赖：\n    ```bash\n    pip install -r requirements.txt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n    ```\n    *若项目中无 `requirements.txt`，请直接运行以下命令安装指定版本：*\n    ```bash\n    pip install numpy==1.17.2 tensorflow==2.0.1 -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n    ```\n\n## 基本使用\n\n项目中的所有模型代码均位于 `\u002Fmodel` 目录下，每个模型拥有独立的文件夹，包含模型定义文件和应用入口文件。\n\n### 运行示例：FastText 模型\n\n以 **FastText** 模型为例，其代码位于 `\u002Fmodel\u002FFastText` 目录：\n*   模型结构定义：`fast_text.py`\n*   应用入口脚本：`main.py`\n\n**启动训练\u002F测试：**\n\n进入对应模型目录并运行 `main.py`：\n\n```bash\ncd model\u002FFastText\npython main.py\n```\n\n### 切换其他模型\n\n若要使用其他模型（如 TextCNN、TextBiRNN、HAN 等），只需进入对应的子目录并运行 `main.py` 即可。例如运行 TextCNN：\n\n```bash\ncd ..\u002FTextCNN\npython main.py\n```\n\n> **注意**：具体数据集路径和超参数配置请在各目录下的 `main.py` 或相关配置文件中进行调整。","某电商公司的数据科学团队正致力于构建一个自动化的用户评论情感分析系统，以实时监控产品口碑并快速响应负面反馈。\n\n### 没有 TextClassification-Keras 时\n- **模型选型试错成本高**：团队需从零手写 FastText、TextCNN 或 RNN 等复杂架构代码，验证不同模型效果耗时数周。\n- **注意力机制实现困难**：想要引入先进的 TextAttBiRNN 或 HAN 模型来捕捉长文本关键信息，但缺乏现成的注意力层参考实现，开发门槛极高。\n- **环境配置与复现混乱**：不同模型依赖的 TensorFlow 版本和预处理逻辑不一致，导致实验环境难以统一，代码复用性差。\n- **基线对比缺失**：缺乏标准化的模型库，难以在同一数据集上公平对比传统方法与深度学习的性能差异。\n\n### 使用 TextClassification-Keras 后\n- **一键切换主流架构**：直接调用库中预置的 FastText、TextCNN、TextBiRNN 等 8 种成熟模型，几天内即可完成多模型横向评测。\n- **高级特性开箱即用**：轻松部署集成了注意力机制的 TextAttBiRNN 和层级网络 HAN，显著提升了长评论分类的准确率。\n- **标准化工程落地**：基于统一的 Keras 框架和 Python 3.7 环境，所有模型目录结构清晰，训练脚本（main.py）即改即用，大幅降低维护成本。\n- **快速确立性能基线**：利用内置的简化应用示例，迅速在内部数据集上跑通全流程，为业务上线提供了可靠的基准数据。\n\nTextClassification-Keras 通过提供一站式的深度学习文本分类模型库，将算法团队的研发重心从“重复造轮子”转移到了“业务价值挖掘”上。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FShawnyXiao_TextClassification-Keras_1761c1fa.png","ShawnyXiao","Xiaoyue Xiao","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FShawnyXiao_ea9b4321.jpg","Focus on Recommender System & NLP","Tencent","Guangdong, China","shawnyxiao@qq.com",null,"https:\u002F\u002Fshawnyxiao.github.io\u002F","https:\u002F\u002Fgithub.com\u002FShawnyXiao",[86],{"name":87,"color":88,"percentage":89},"Python","#3572A5",100,812,186,"2026-03-17T07:55:27","MIT","","未说明",{"notes":97,"python":98,"dependencies":99},"该工具基于 Keras (TensorFlow 2.0.1) 框架实现多种文本分类模型（如 FastText, TextCNN, TextRNN 等）。代码位于 \u002Fmodel 目录下，每个模型有独立的目录包含模型定义和应用脚本。README 中未明确指定操作系统、GPU 及内存需求，通常 TensorFlow 2.x 支持 Linux、macOS 和 Windows，具体硬件需求取决于训练数据规模和模型复杂度。","3.7",[100,101],"NumPy==1.17.2","Tensorflow==2.0.1",[15,38],[104,105,106,107,108,109,110,111],"text-classification","nlp","keras","fasttext","textcnn","textrnn","han","rcnn","2026-03-27T02:49:30.150509","2026-04-06T06:46:00.191204",[],[]]