benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f4fb7a03-e892-5a37-8570-f1bec9a5f9fb

Problem

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

complete prompt

import collections
import matplotlib.pyplot as plt
import pandas as pd


# Constants
WORDS = ['the', 'be', 'to', 'of', 'and', 'a', 'in', 'that', 'have', 'I']

def task_func(sentences_dict, word_keys):
    """
    Calculate the occurrence of certain words in a collection of sentences and return a bar chart.

    Parameters:
    sentences_dict (dict): The dictionary containing sentences.
    word_keys (list): The list of words.

    Returns:
    - matplotlib.axes._axes.Axes: Axes object of the bar chart displaying the frequencies.

    Requirements:
    - collections
    - matplotlib.pyplot
    - pandas

    Example:
    >>> sentences_dict = {'Sentence1': 'the quick brown fox', 'Sentence2': 'jumps over the lazy dog', 'Sentence3': 'the dog is brown'}
    >>> word_keys = ['the', 'dog']
    >>> type(task_func(sentences_dict, word_keys))
    <class 'matplotlib.axes._axes.Axes'>
    """

instruct prompt

Calculate the occurrence of certain words in a collection of sentences and return a bar chart.
The function should output with:
    matplotlib.axes._axes.Axes: Axes object of the bar chart displaying the frequencies.
You should write self-contained code starting with:

Code

import collections
import matplotlib.pyplot as plt
import pandas as pd
# Constants
WORDS = ['the', 'be', 'to', 'of', 'and', 'a', 'in', 'that', 'have', 'I']
def task_func(sentences_dict, word_keys):

code prompt

Code

import collections
import matplotlib.pyplot as plt
import pandas as pd
# Constants
WORDS = ['the', 'be', 'to', 'of', 'and', 'a', 'in', 'that', 'have', 'I']
def task_func(sentences_dict, word_keys):

entry point

task_func

libs

  • pandas
  • collections
  • matplotlib

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