You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行scores = score.sentiment(ari_txt, pos, neg, .progress='text')时遇报错:对象'ari_txt'未找到

Fixing the "object 'ari_txt' not found" Error in R

Hey there! Let's break down why you're hitting this error and walk through how to fix it step by step.

The Core Issue

The error Error in inherits(.data, "split") : object 'ari_txt' not found means exactly what it says: R can't find a variable named ari_txt in your current working environment. This is one of the most common R errors, and it's usually easy to resolve.

Step-by-Step Fixes

  • First, verify if ari_txt exists at all
    Run this command in your R console to check:

    exists("ari_txt")
    

    If it returns FALSE, you need to create or import the ari_txt object before running your sentiment scoring code.

  • Create or import your text data
    Depending on where your text comes from, do one of the following:

    • If you're working with a local text file: Use readLines() or a package like readr to load it:
      # Example: Load a text file into ari_txt
      ari_txt <- readLines("your_text_file.txt")
      
    • If you're defining text manually: Assign your text directly to ari_txt:
      # Example: Create a vector of text strings
      ari_txt <- c("I love working with sentiment analysis", "This project feels frustrating right now")
      
  • Check for typos and case sensitivity
    R is strictly case-sensitive! Double-check that you didn't misspell the variable name—for example, Ari_txt, ariTxt, or ari_text won't be recognized as ari_txt.

  • Confirm the variable is in your current environment
    Run ls() in the console to list all variables in your current workspace. If ari_txt isn't listed, it's either not created or was created in a different environment (like inside a function).

Example Working Code

Here's a complete example to test with:

# 1. Define your text data
ari_txt <- c("This is a positive statement", "I'm feeling really negative today")

# 2. Define your positive/negative dictionaries (adjust as needed)
pos <- c("positive", "great", "happy")
neg <- c("negative", "sad", "frustrated")

# 3. Run the sentiment scoring function
scores <- score.sentiment(ari_txt, pos, neg, .progress='text')

内容的提问来源于stack exchange,提问作者Hanif Khan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:33:25