Skip to content

Commit

Permalink
CU-1yn0v9e: Fix typo in docstring; more consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
mart-r committed Oct 31, 2023
1 parent bf7f756 commit db1f6f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions medcat/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1546,22 +1546,22 @@ 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,
only_cui: bool = False,
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,
Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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])
Expand All @@ -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])
Expand Down

0 comments on commit db1f6f5

Please sign in to comment.