benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 6b4d4c4f-79b1-5800-9f65-4f833b9f39aa
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import nltk
from string import punctuation
import seaborn as sns
import matplotlib.pyplot as plt
# Constants
PUNCTUATION = set(punctuation)
def task_func(text):
"""
Draw a bar chart of the frequency of words in a text beginning with the "
$" character. Words that start with the '$' character but consist only of punctuation (e.g., '' and '') are not included in the frequency count.
- If there is no word respecting the above conditions, the plot should be None.
- The barplot x words on the x-axis and frequencies on the y-axis.
Parameters:
- text (str): The input text.
Returns:
- matplotlib.axes._axes.Axes: The plot showing the frequency of words beginning with the '$' character.
Requirements:
- nltk
- string
- seaborn
- matplotlib
Example:
>>> text = "$child than resource indicate star exactly onto then age charge let product coach decision professional alone beat idea bit call performance follow your resource road $data performance himself school here"
>>> ax = task_func(text)
>>> print(ax)
Axes(0.125,0.11;0.775x0.77)
"""
Plain-text mathematical notation (without MathML)
import nltk
from string import punctuation
import seaborn as sns
import matplotlib.pyplot as plt
# Constants
PUNCTUATION = set(punctuation)
def task_func(text):
"""
Draw a bar chart of the frequency of words in a text beginning with the "$" character. Words that start with the '$' character but consist only of punctuation (e.g., '!' and '.') are not included in the frequency count.
- If there is no word respecting the above conditions, the plot should be None.
- The barplot x words on the x-axis and frequencies on the y-axis.
Parameters:
- text (str): The input text.
Returns:
- matplotlib.axes._axes.Axes: The plot showing the frequency of words beginning with the '$' character.
Requirements:
- nltk
- string
- seaborn
- matplotlib
Example:
>>> text = "$child than resource indicate star communitystationontobestgreenexactly onto then age charge friendthanreadychildreallylet product coach decision professional cameralifeoffmanagementfactoralone beat idea bit call campaignfillstandCongressstuffperformance follow your resource road $data performance himself school here"
>>> ax = task_func(text)
>>> print(ax)
Axes(0.125,0.11;0.775x0.77)
"""
Original LaTeX notation
import nltk
from string import punctuation
import seaborn as sns
import matplotlib.pyplot as plt
# Constants
PUNCTUATION = set(punctuation)
def task_func(text):
"""
Draw a bar chart of the frequency of words in a text beginning with the "$" character. Words that start with the '$' character but consist only of punctuation (e.g., '$!$' and '$.$') are not included in the frequency count.
- If there is no word respecting the above conditions, the plot should be None.
- The barplot x words on the x-axis and frequencies on the y-axis.
Parameters:
- text (str): The input text.
Returns:
- matplotlib.axes._axes.Axes: The plot showing the frequency of words beginning with the '$' character.
Requirements:
- nltk
- string
- seaborn
- matplotlib
Example:
>>> text = "$child than resource indicate star $community station onto best green $exactly onto then age charge $friend than ready child really $let product coach decision professional $camera life off management factor $alone beat idea bit call $campaign fill stand Congress stuff $performance follow your resource road $data performance himself school here"
>>> ax = task_func(text)
>>> print(ax)
Axes(0.125,0.11;0.775x0.77)
"""
instruct prompt
Draw a bar chart of the frequency of words in a text beginning with the "
$" character. Words that start with the '$' character but consist only of punctuation (e.g., '' and '') are not included in the frequency count. - If there is no word respecting the above conditions, the plot should be None. - The barplot x words on the x-axis and frequencies on the y-axis.
The function should output with:
matplotlib.axes._axes.Axes: The plot showing the frequency of words beginning with the '$' character.
You should write self-contained code starting with:
Plain-text mathematical notation (without MathML)
Draw a bar chart of the frequency of words in a text beginning with the "$" character. Words that start with the '$' character but consist only of punctuation (e.g., '!' and '.') are not included in the frequency count. - If there is no word respecting the above conditions, the plot should be None. - The barplot x words on the x-axis and frequencies on the y-axis.
The function should output with:
matplotlib.axes._axes.Axes: The plot showing the frequency of words beginning with the '$' character.
You should write self-contained code starting with:
Original LaTeX notation
Draw a bar chart of the frequency of words in a text beginning with the "$" character. Words that start with the '$' character but consist only of punctuation (e.g., '$!$' and '$.$') are not included in the frequency count. - If there is no word respecting the above conditions, the plot should be None. - The barplot x words on the x-axis and frequencies on the y-axis.
The function should output with:
matplotlib.axes._axes.Axes: The plot showing the frequency of words beginning with the '$' character.
You should write self-contained code starting with:
Code
import nltk
from string import punctuation
import seaborn as sns
import matplotlib.pyplot as plt
# Constants
PUNCTUATION = set(punctuation)
def task_func(text):
code prompt
Code
import nltk
from string import punctuation
import seaborn as sns
import matplotlib.pyplot as plt
# Constants
PUNCTUATION = set(punctuation)
def task_func(text):
entry point
task_func
libs
- nltk
- matplotlib
- string
- seaborn
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