benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf b60efff0-f581-5d10-92db-7f7de4b6e16b

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import re
import nltk
nltk.download('stopwords')

from nltk.corpus import stopwords
from textblob import TextBlob

# Constants
STOPWORDS = set(stopwords.words('english'))

def task_func(text):
    """
    Remove duplicate and stopwords from a string "text."
    Then, analyze the sentiment of the text using TextBlob.

    Parameters:
    - text (str): The text string to analyze.

    Returns:
    - Sentiment: The sentiment of the text.

    Requirements:
    - re
    - nltk.corpus.stopwords
    - textblob.TextBlob

    Example:
    >>> text = "The quick brown fox jumps over the lazy dog and the dog was not that quick to respond."
    >>> sentiment = task_func(text)
    >>> print(sentiment)
    Sentiment(polarity=0.13888888888888887, subjectivity=0.6666666666666666)
    """

instruct prompt

Remove duplicate and stopwords from a string "text." Then, analyze the sentiment of the text using TextBlob.
The function should output with:
    Sentiment: The sentiment of the text.
You should write self-contained code starting with:

Code

import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from textblob import TextBlob
# Constants
STOPWORDS = set(stopwords.words('english'))
def task_func(text):

code prompt

Code

import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from textblob import TextBlob
# Constants
STOPWORDS = set(stopwords.words('english'))
def task_func(text):

entry point

task_func

libs

  • nltk
  • textblob
  • re

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import