🚀 文本体裁预测模型
本模型旨在预测任意网络文本的体裁,可集成到标准流程中,为文本分类提供高效解决方案。
🚀 快速开始
本模型可轻松集成到标准流程中,以下是使用示例:
from transformers import pipeline
classifier = pipeline("text-classification",model='ssharoff/genres')
print(classifier("Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it. `And what is the use of a book,' thought Alice `without pictures or conversation? So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her. There was nothing so very remarkable in that; nor did Alice think it so very much out of the way to hear the Rabbit say to itself, `Oh dear! Oh dear! I shall be late!' (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually took a watch out of its waistcoat-pocket, and looked at it, and then hurried on, Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to take out of it, and burning with curiosity, she ran across the field after it, and fortunately was just in time to see it pop down a large rabbit-hole under the hedge. In another moment down went Alice after it, never once considering how in the world she was to get out again. The rabbit-hole went straight on like a tunnel for some way, and then dipped suddenly down, so suddenly that Alice had not a moment to think about stopping herself before she found herself falling down a very deep well.", top_k=2))
print(classifier("The gratitude of every home in our Island, in our Empire, and indeed throughout the world, except in the abodes of the guilty, goes out to the British airmen who, undaunted by odds, unwearied in their constant challenge and mortal danger, are turning the tide of the World War by their prowess and by their devotion. Never in the field of human conflict was so much owed by so many to so few. ", top_k=2))
💻 使用示例
基础用法
from transformers import pipeline
classifier = pipeline("text-classification",model='ssharoff/genres')
print(classifier("输入待分类的文本内容", top_k=2))
高级用法
print(classifier("输入待分类的文本内容", top_k=3))
📚 详细文档
分类标签说明
代码 |
标签 |
待回答的问题 |
原型示例 |
A1 |
论证类 |
文本在多大程度上进行论证以说服读者支持某种观点或立场? |
议论文博客、社论或观点文章 |
A4 |
虚构类 |
文本内容的虚构程度如何? |
小说、诗歌、神话、电影剧情简介 |
A7 |
指导类 |
文本在多大程度上旨在教导读者某事物的运作方式或提供建议? |
教程或常见问题解答。这也包括问题列表本身。 |
A8 |
报道类 |
文本在多大程度上像是对近期事件的信息性报道? |
新闻报道。关于未来事件的信息也可视为报道。如果新闻文章仅讨论一种情况,则为“无”。 |
A9 |
法律类 |
文本在多大程度上规定了一套规则? |
法律、合同、版权声明、条款和条件 |
A11 |
个人类 |
文本在多大程度上报道了第一人称的故事? |
日记条目、旅行博客 |
A12 |
商业类 |
文本在多大程度上推广了产品或服务? |
广告、垃圾邮件 |
A14 |
学术类 |
文本在多大程度上报道了学术研究? |
学术研究论文 |
A16 |
信息类 |
文本在多大程度上提供参考信息以定义文本的主题? |
百科文章、字典定义、规格说明 |
A17 |
评论类 |
文本在多大程度上通过支持或批评来评价特定实体? |
产品、地点或表演的评论 |
标注指南
请查看标注指南
预测分类体系
本模型的预测分类体系遵循以下文献:
@Article{sharoff18genres,
author = {Serge Sharoff},
title = {Functional Text Dimensions for the annotation of {Web} corpora},
journal = {Corpora},
volume = {13},
number = {1},
pages = {65--95},
year = {2018}
}
[http://corpus.leeds.ac.uk/serge/publications/2018-ftd.pdf]
📄 许可证
本项目采用CC BY-SA 4.0许可证。