arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2307.13106cs.CLcs.AI
收藏

如何使用LLM进行文本分析

How to use LLMs for Text Analysis

University of Amsterdam(阿姆斯特丹大学);Institute of Language, Logic and Computation (ILLC)(语言、逻辑与计算研究所(ILLC))

Petter Törnberg

AI总结:

本指南介绍LLM作为社会科学中通用的文本分析方法,通过Python逐步演示安装、API设置、数据加载、提示开发、文本分析与结果验证,并以识别政治文本中的民粹主义为例展示其超越现有最先进水平的能力。

摘要:

本指南将大型语言模型(LLM)作为一种在社会科学中高度通用的文本分析方法进行介绍。由于LLM易于使用、成本低廉、速度快,并且适用于广泛的文本分析任务,从文本标注和分类到情感分析和批判性话语分析,许多学者认为LLM将改变我们进行文本分析的方式。本操作指南面向编程经验有限的学生和研究人员,提供了关于如何在您自己的研究项目中使用LLM进行文本分析的简单介绍,以及最佳实践建议。我们将逐步介绍使用Python通过LLM分析文本数据的每个步骤:安装软件、设置API、加载数据、开发分析提示、分析文本以及验证结果。作为示例,我们将使用识别政治文本中民粹主义这一具有挑战性的任务,并展示LLM如何超越现有的最先进水平。

英文摘要:

This guide introduces Large Language Models (LLM) as a highly versatile text analysis method within the social sciences. As LLMs are easy-to-use, cheap, fast, and applicable on a broad range of text analysis tasks, ranging from text annotation and classification to sentiment analysis and critical discourse analysis, many scholars believe that LLMs will transform how we do text analysis. This how-to guide is aimed at students and researchers with limited programming experience, and offers a simple introduction to how LLMs can be used for text analysis in your own research project, as well as advice on best practices. We will go through each of the steps of analyzing textual data with LLMs using Python: installing the software, setting up the API, loading the data, developing an analysis prompt, analyzing the text, and validating the results. As an illustrative example, we will use the challenging task of identifying populism in political texts, and show how LLMs move beyond the existing state-of-the-art.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑