benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 0bbf393f-c8a3-5686-8120-c12d42978dcd
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import pandas as pd
import regex as re
# Constants
STOPWORDS = ["a", "an", "the", "in", "is", "are"]
def task_func(text):
"""
Count the frequency of each word in a text after removing specific stopwords.
Parameters:
text (str): The text to analyze.
Returns:
Series: A pandas Series with word frequencies excluding the words in STOPWORDS list.
Requirements:
- pandas
- regex
Example:
>>> text = "This is a sample text. This text contains sample words."
>>> word_counts = task_func(text)
>>> print(word_counts)
this 2
sample 2
text 2
contains 1
words 1
dtype: int64
"""
instruct prompt
Count the frequency of each word in a text after removing specific stopwords.
The function should output with:
Series: A pandas Series with word frequencies excluding the words in STOPWORDS list.
You should write self-contained code starting with:
Code
import pandas as pd
import regex as re
# Constants
STOPWORDS = ["a", "an", "the", "in", "is", "are"]
def task_func(text):
code prompt
Code
import pandas as pd
import regex as re
# Constants
STOPWORDS = ["a", "an", "the", "in", "is", "are"]
def task_func(text):
entry point
task_func
libs
- regex
- pandas
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
initial import