benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 5f3ceaaf-afe2-5ff6-b165-74595984b675

Problem

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

complete prompt

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


def task_func(text: str) -> dict:
    """
    Count the number of non-stop words in a given text.
    
    Parameters:
    - text (str): The input text for word counting.
    
    Returns:
    dict: A dictionary with the words (as keys) and their counts (as values).
    
    Requirements:
    - re
    - collections.Counter
    
    Example:
    >>> count = task_func("This is a sample text. Some words are repeated.")
    >>> print(count)
    {'sample': 1, 'text': 1, 'words': 1, 'repeated': 1}
    """

instruct prompt

Count the number of non-stop words in a given text.
The function should output with:
    dict: A dictionary with the words (as keys) and their counts (as values).
You should write self-contained code starting with:

Code

import re
from collections import Counter
from nltk.corpus import stopwords
def task_func(text: str) -> dict:

code prompt

Code

import re
from collections import Counter
from nltk.corpus import stopwords
def task_func(text: str) -> dict:

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