benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 7363cfe9-f59c-55ea-a6ae-7374baec4735

Problem

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

complete prompt

import re
from nltk.corpus import stopwords
from collections import Counter

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

def task_func(input_string):
    """
    Divide a multi-line string into individual lines, remove stopwords, and count the frequency of each word.

    Parameters:
    - input_string (str): The multi-line string.

    Returns:
    - dict: A dictionary with word frequencies where each key is a unique word and the value is its frequency.

    Requirements:
    - re
    - nltk.corpus
    - collections

    Example:
    >>> task_func('line a\\nfollows by line b\\n...bye\\n')
    {'line': 2, 'follows': 1, 'b': 1, 'bye': 1}
    """

instruct prompt

Divide a multi-line string into individual lines, remove stopwords, and count the frequency of each word.
The function should output with:
    dict: A dictionary with word frequencies where each key is a unique word and the value is its frequency.
You should write self-contained code starting with:

Code

import re
from nltk.corpus import stopwords
from collections import Counter
STOPWORDS = set(stopwords.words('english'))
def task_func(input_string):

code prompt

Code

import re
from nltk.corpus import stopwords
from collections import Counter
STOPWORDS = set(stopwords.words('english'))
def task_func(input_string):

entry point

task_func

libs

  • nltk
  • collections
  • 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