-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Sometime, when all clusters pass example, the minor cluster may be correct and the major cluster may be incorrect. In this case, our repair will fail and passk will drop to 0. But for the ambiguous original requirement, due to the ambiguity, their passk may be low but not 0.
Example:
Humaneval/125
from typing import List
from typing import Union
def split_words(txt: str) -> Union[List[str], int]:
'''
Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you
should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
Examples
split_words("Hello world!") ➞ ["Hello", "world!"]
split_words("Hello,world!") ➞ ["Hello", "world!"]
split_words("abcdef") == 3
'''
The largest cluster program:
from typing import List, Union
def split_words(txt: str) -> Union[List[str], int]:
if ' ' in txt:
return txt.split()
elif ',' in txt:
return txt.split(',')
else:
count = 0
for char in txt:
if char.islower():
if (ord(char) - ord('a')) % 2 != 0:
count += 1
return count
The minor cluster program:
from typing import List, Union
def split_words(txt: str) -> Union[List[str], int]:
if ' ' in txt:
return txt.split(' ')
elif ',' in txt:
return txt.split(',')
else:
count = 0
for char in txt:
if char.islower():
order = ord(char) - ord('a')
if order % 2 != 0:
count += 1
return count
The difference is how to solve the multiple consecutive whitespaces and multiple consecutive commas. Unluckily, the minor cluster is partial correct. The minor cluster use txt.split(' ') instead of txt.split().
Metadata
Metadata
Assignees
Labels
No labels