benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 7e24476e-2c84-5635-b0fe-0375c2fc90af

Problem

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

complete prompt

import re
import numpy as np
from scipy.stats import ttest_rel

def task_func(text1, text2):
    """
    Perform a paired t-test for the number of words in two strings, only if the strings produce the same number of words.
    
    Parameters:
    - text1 (str), text2 (str): The two text strings.
    
    Returns:
    - t_statistic (float): The t-statistic, or NaN if tests cannot be performed due to unequal lengths.
    - p_value (float): The p-value, or NaN if tests cannot be performed due to unequal lengths.
    
    Requirements:
    - re
    - numpy
    - scipy
    
    Example:
    >>> task_func('Words, words, words.', 'And more words!')
    (1.7320508075688774, 0.22540333075851657)
    """

instruct prompt

Perform a paired t-test for the number of words in two strings, only if the strings produce the same number of words.
The function should output with:
    t_statistic (float): The t-statistic, or NaN if tests cannot be performed due to unequal lengths.
    p_value (float): The p-value, or NaN if tests cannot be performed due to unequal lengths.
You should write self-contained code starting with:

Code

import re
import numpy as np
from scipy.stats import ttest_rel
def task_func(text1, text2):

code prompt

Code

import re
import numpy as np
from scipy.stats import ttest_rel
def task_func(text1, text2):

entry point

task_func

libs

  • re
  • numpy
  • scipy

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