benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 0d302150-a3e3-53ed-9eb0-3ef637b70fa6

Problem

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

complete prompt

import nltk
nltk.download('stopwords')
from collections import Counter
import os
from nltk.corpus import stopwords

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

def task_func(directory_path):
    """
    Count the number of unique non-stop words across all '.txt' files in a specified directory.

    Parameters:
    directory_path (str): The path to the directory containing '.txt' files.

    Returns:
    int: The total count of unique non-stop words across all files.

    Requirements:
    - collections.Counter
    - os
    - nltk.corpus.stopwords

    Example:
    >>> task_func('./yourdictfiles/')
    1500
    """

instruct prompt

Count the number of unique non-stop words across all '.txt' files in a specified directory.
The function should output with:
    int: The total count of unique non-stop words across all files.
You should write self-contained code starting with:

Code

import nltk
nltk.download('stopwords')
from collections import Counter
import os
from nltk.corpus import stopwords
# Constants
STOPWORDS = set(stopwords.words('english'))
def task_func(directory_path):

code prompt

Code

import nltk
nltk.download('stopwords')
from collections import Counter
import os
from nltk.corpus import stopwords
# Constants
STOPWORDS = set(stopwords.words('english'))
def task_func(directory_path):

entry point

task_func

libs

  • nltk
  • collections
  • os

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