benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 8dd4af8d-79bc-527b-8cc0-f6b4a9f57887

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


def task_func(text: str) -> dict:
    """
    Analyzes a given text string by removing duplicate words and stopwords defined by nltk.corpus ,
    and then returns a frequency distribution of the remaining words.

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

    Returns:
    - dict: The frequency distribution of the words in the text after filtering.

    Requirements:
    - re
    - nltk.corpus

    Note:
    - A manually defined set of common English stopwords is used for filtering.

    Examples:
    >>> task_func("The quick brown fox jumps over the lazy dog and the dog was not that quick to respond.")
    {'quick': 1, 'brown': 1, 'fox': 1, 'jumps': 1, 'lazy': 1, 'dog': 1, 'respond': 1}

    >>> task_func("hello hello world")
    {'hello': 1, 'world': 1}
    """

instruct prompt

Analyzes a given text string by removing duplicate words and stopwords defined by nltk.corpus , and then returns a frequency distribution of the remaining words. >>> task_func("hello hello world") {'hello': 1, 'world': 1}
Note that: A manually defined set of common English stopwords is used for filtering.
The function should output with:
    dict: The frequency distribution of the words in the text after filtering.
You should write self-contained code starting with:

Code

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

code prompt

Code

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

entry point

task_func

libs

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