From db1f6f587483c60022fd078958c76dde7dd85ae1 Mon Sep 17 00:00:00 2001 From: mart-r Date: Tue, 31 Oct 2023 09:47:23 +0000 Subject: [PATCH] CU-1yn0v9e: Fix typo in docstring; more consistent naming --- medcat/cat.py | 8 ++++---- tests/test_cat.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/medcat/cat.py b/medcat/cat.py index 5488ff6e3..d8f49f0ad 100644 --- a/medcat/cat.py +++ b/medcat/cat.py @@ -1546,7 +1546,7 @@ def _multiprocessing_batch(self, return docs - @deprecated(message="Use `multiprocessing_batch_nr_of_docs` instead") + @deprecated(message="Use `multiprocessing_batch_docs_size` instead") def multiprocessing_pipe(self, in_data: Union[List[Tuple], Iterable[Tuple]], nproc: Optional[int] = None, batch_size: Optional[int] = None, @@ -1554,14 +1554,14 @@ def multiprocessing_pipe(self, in_data: Union[List[Tuple], Iterable[Tuple]], addl_info: List[str] = [], return_dict: bool = True, batch_factor: int = 2) -> Union[List[Tuple], Dict]: - return self.multiprocessing_batch_nr_of_docs(in_data=in_data, nproc=nproc, + return self.multiprocessing_batch_docs_size(in_data=in_data, nproc=nproc, batch_size=batch_size, only_cui=only_cui, addl_info=addl_info, return_dict=return_dict, batch_factor=batch_factor) - def multiprocessing_batch_nr_of_docs(self, + def multiprocessing_batch_docs_size(self, in_data: Union[List[Tuple], Iterable[Tuple]], nproc: Optional[int] = None, batch_size: Optional[int] = None, @@ -1571,7 +1571,7 @@ def multiprocessing_batch_nr_of_docs(self, batch_factor: int = 2) -> Union[List[Tuple], Dict]: """Run multiprocessing NOT FOR TRAINING. - Thios method batches the data based on the number of documents as specified by the user. + This method batches the data based on the number of documents as specified by the user. PS: This method supports Windows. diff --git a/tests/test_cat.py b/tests/test_cat.py index a8676bd18..f3b651dc6 100644 --- a/tests/test_cat.py +++ b/tests/test_cat.py @@ -73,7 +73,7 @@ def test_multiprocessing_pipe(self): (2, "The dog is sitting outside the house."), (3, "The dog is sitting outside the house."), ] - out = self.undertest.multiprocessing_batch_nr_of_docs(in_data, nproc=2, return_dict=False) + out = self.undertest.multiprocessing_batch_docs_size(in_data, nproc=2, return_dict=False) self.assertTrue(type(out) == list) self.assertEqual(3, len(out)) self.assertEqual(1, out[0][0]) @@ -89,7 +89,7 @@ def test_multiprocessing_pipe_with_malformed_texts(self): (2, ""), (3, None), ] - out = self.undertest.multiprocessing_batch_nr_of_docs(in_data, nproc=1, batch_size=1, return_dict=False) + out = self.undertest.multiprocessing_batch_docs_size(in_data, nproc=1, batch_size=1, return_dict=False) self.assertTrue(type(out) == list) self.assertEqual(3, len(out)) self.assertEqual(1, out[0][0]) @@ -105,7 +105,7 @@ def test_multiprocessing_pipe_return_dict(self): (2, "The dog is sitting outside the house."), (3, "The dog is sitting outside the house.") ] - out = self.undertest.multiprocessing_batch_nr_of_docs(in_data, nproc=2, return_dict=True) + out = self.undertest.multiprocessing_batch_docs_size(in_data, nproc=2, return_dict=True) self.assertTrue(type(out) == dict) self.assertEqual(3, len(out)) self.assertEqual({'entities': {}, 'tokens': []}, out[1])