diff --git a/machine/jobs/translation_file_service.py b/machine/jobs/translation_file_service.py index 24b1c3c8..3472aa80 100644 --- a/machine/jobs/translation_file_service.py +++ b/machine/jobs/translation_file_service.py @@ -15,7 +15,8 @@ class PretranslationInfo(TypedDict): corpusId: str # noqa: N815 textId: str # noqa: N815 - refs: List[str] + sourceRefs: List[str] # noqa: N815 + targetRefs: List[str] # noqa: N815 translation: str sourceTokens: List[str] # noqa: N815 translationTokens: List[str] # noqa: N815 @@ -94,7 +95,8 @@ def generator() -> Generator[PretranslationInfo, None, None]: yield PretranslationInfo( corpusId=pi["corpusId"], textId=pi["textId"], - refs=list(pi["refs"]), + sourceRefs=list(pi["sourceRefs"]), + targetRefs=list(pi["targetRefs"]), translation=pi["translation"], sourceTokens=list(), translationTokens=list(), diff --git a/machine/jobs/word_alignment_build_job.py b/machine/jobs/word_alignment_build_job.py index 0f74ab40..8838ddb3 100644 --- a/machine/jobs/word_alignment_build_job.py +++ b/machine/jobs/word_alignment_build_job.py @@ -105,8 +105,8 @@ def _batch_inference( [ ParallelTextRow( ii["textId"], - ii["refs"], - ii["refs"], + ii["sourceRefs"], + ii["targetRefs"], list(self._tokenizer.tokenize(ii["source"])), list(self._tokenizer.tokenize(ii["target"])), ) @@ -132,7 +132,8 @@ def _batch_inference( word_alignment_info = { "corpusId": inference_input["corpusId"], "textId": inference_input["textId"], - "refs": [str(ref) for ref in inference_input["refs"]], + "sourceRefs": [str(ref) for ref in inference_input["sourceRefs"]], + "targetRefs": [str(ref) for ref in inference_input["targetRefs"]], "sourceTokens": parallel_text_row.source_segment, "targetTokens": parallel_text_row.target_segment, "alignment": AlignedWordPair.to_string(word_pairs), diff --git a/machine/jobs/word_alignment_file_service.py b/machine/jobs/word_alignment_file_service.py index 831d07b0..0c02d9cf 100644 --- a/machine/jobs/word_alignment_file_service.py +++ b/machine/jobs/word_alignment_file_service.py @@ -13,7 +13,8 @@ class WordAlignmentInput(TypedDict): corpusId: str # noqa: N815 textId: str # noqa: N815 - refs: List[str] + sourceRefs: List[str] # noqa: N815 + targetRefs: List[str] # noqa: N815 source: str target: str @@ -62,7 +63,8 @@ def get_word_alignment_inputs(self) -> List[WordAlignmentInput]: WordAlignmentInput( corpusId=pi["corpusId"], textId=pi["textId"], - refs=list(pi["refs"]), + sourceRefs=list(pi["sourceRefs"]), + targetRefs=list(pi["targetRefs"]), source=pi["source"], target=pi["target"], ) diff --git a/tests/jobs/test_nmt_engine_build_job.py b/tests/jobs/test_nmt_engine_build_job.py index af6261f7..e3524f8b 100644 --- a/tests/jobs/test_nmt_engine_build_job.py +++ b/tests/jobs/test_nmt_engine_build_job.py @@ -133,7 +133,8 @@ def __init__(self, decoy: Decoy) -> None: PretranslationInfo( corpusId="corpus1", textId="text1", - refs=["ref1"], + sourceRefs=["ref1"], + targetRefs=["ref1"], translation="Por favor, tengo reservada una habitación.", sourceTokens=[], translationTokens=[], diff --git a/tests/jobs/test_smt_engine_build_job.py b/tests/jobs/test_smt_engine_build_job.py index 9464e706..0544faa5 100644 --- a/tests/jobs/test_smt_engine_build_job.py +++ b/tests/jobs/test_smt_engine_build_job.py @@ -136,7 +136,8 @@ def __init__(self, decoy: Decoy) -> None: PretranslationInfo( corpusId="corpus1", textId="text1", - refs=["ref1"], + sourceRefs=["ref1"], + targetRefs=["ref1"], translation="Por favor, tengo reservada una habitación.", sourceTokens=[], translationTokens=[], diff --git a/tests/jobs/test_word_alignment_build_job.py b/tests/jobs/test_word_alignment_build_job.py index 96dcc082..63b6b816 100644 --- a/tests/jobs/test_word_alignment_build_job.py +++ b/tests/jobs/test_word_alignment_build_job.py @@ -95,21 +95,24 @@ def __init__(self, decoy: Decoy) -> None: WordAlignmentInput( corpusId="corpus1", textId="text1", - refs=["1"], + sourceRefs=["1"], + targetRefs=["1"], source="¿Le importaría darnos las llaves de la habitación, por favor?", target="Would you mind giving us the room keys, please?", ), WordAlignmentInput( corpusId="corpus1", textId="text1", - refs=["2"], + sourceRefs=["2"], + targetRefs=["2"], source="¿Le importaría cambiarme a otra habitación más tranquila?", target="Would you mind moving me to another quieter room?", ), WordAlignmentInput( corpusId="corpus1", textId="text1", - refs=["3"], + sourceRefs=["3"], + targetRefs=["3"], source="Me parece que existe un problema.", target="I think there is a problem.", ),