Spaces:
Runtime error
Runtime error
github-actions commited on
Commit ·
48fa02d
1
Parent(s): 695eff8
Auto files update [main]
Browse files11 unmodified lines121314151617181920212224 unmodified lines4748495051525356 unmodified lines11011111211311411511611711811912012111 unmodified lines# See the License for the specific language governing permissions and# limitations under the License."""TODO: Add a description here."""import datasetsimport evaluatefrom codebleu import calc_codebleu# TODO: Add BibTeX citation_CITATION = """\24 unmodified linesshould be a string with tokens separated by spaces.references: list of reference for each prediction. Eachreference should be a string with tokens separated by spaces.language: programming language in ['java','js','c_sharp','php','go','python','ruby'].weights: tuple of 4 floats to use as weights for scores. Defaults to (0.25, 0.25, 0.25, 0.25).Returns:codebleu: resulting `CodeBLEU` score,56 unmodified linesdef _download_and_prepare(self, dl_manager):"""Optional: download external resources useful to compute the scores"""# TODO: Download external resources if neededpassdef _compute(self, predictions, references, lang, weights=(0.25, 0.25, 0.25, 0.25), tokenizer=None):"""Returns the scores"""return calc_codebleu(references=references,predictions=predictions,lang=lang,11 unmodified lines121314151617181920212224 unmodified lines4748495051525356 unmodified lines11011111211311411511611711811912012112211 unmodified lines# See the License for the specific language governing permissions and# limitations under the License."""TODO: Add a description here."""import importlibimport datasetsimport evaluate# TODO: Add BibTeX citation_CITATION = """\24 unmodified linesshould be a string with tokens separated by spaces.references: list of reference for each prediction. Eachreference should be a string with tokens separated by spaces.language: programming language in ['java','js','c_sharp','php','c','python','cpp'].weights: tuple of 4 floats to use as weights for scores. Defaults to (0.25, 0.25, 0.25, 0.25).Returns:codebleu: resulting `CodeBLEU` score,56 unmodified linesdef _download_and_prepare(self, dl_manager):"""Optional: download external resources useful to compute the scores"""# workarounds as this file have to be named codebleu (evaluate library requirement)self.codebleu_package = importlib.import_module('codebleu')passdef _compute(self, predictions, references, lang, weights=(0.25, 0.25, 0.25, 0.25), tokenizer=None):"""Returns the scores"""return self.codebleu_package.calc_codebleu(references=references,predictions=predictions,lang=lang,
codebleu.py+5-4