File size: 1,236 Bytes
dbf7be3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import evaluate
from evaluate.utils import launch_gradio_widget
# import re 

# match = re.match(
#                 r"^from\s+(\.?)([^\s\.]+)(?:[^\s]*)\s+import\s+[^#\r\n]*(?:#\s+From:\s+)?([^\r\n]*)",
#                 "from .bleu import bleu",
#                 flags=re.MULTILINE,
#             )
# match = re.match(r"^import\s+(\.?)([^\s\.]+)[^#\r\n]*(?:#\s+From:\s+)?([^\r\n]*)", "import .bleu", flags=re.MULTILINE)

# print(match)
module = evaluate.load("dvitel/codebleu")
launch_gradio_widget(module)
# src = 'class AcidicSwampOoze(MinionCard):§    def __init__(self):§        super().__init__("Acidic Swamp Ooze", 2, CHARACTER_CLASS.ALL, CARD_RARITY.COMMON, battlecry=Battlecry(Destroy(), WeaponSelector(EnemyPlayer())))§§    def create_minion(self, player):§        return Minion(3, 2)§'
# tgt = 'class AcidSwampOoze(MinionCard):§    def __init__(self):§        super().__init__("Acidic Swamp Ooze", 2, CHARACTER_CLASS.ALL, CARD_RARITY.COMMON, battlecry=Battlecry(Destroy(), WeaponSelector(EnemyPlayer())))§§    def create_minion(self, player):§        return Minion(3, 2)§'
# src = src.replace("Β§","\n")
# tgt = tgt.replace("Β§","\n")
# res = module.compute(predictions = [tgt], references = [[src]])
# print(res)