Update utilitites
This commit is contained in:
parent
266e43b18a
commit
c5cafbee47
2 changed files with 16 additions and 1 deletions
|
|
@ -0,0 +1,12 @@
|
||||||
|
from .clean import clean
|
||||||
|
from .evaluate_ranking import evaluate_ranking
|
||||||
|
from .get_sentences import get_sentences
|
||||||
|
from .language import english_name_of_language, is_english, predict_language
|
||||||
|
from .lemmatize_text import lemmatize_text
|
||||||
|
from .lemmatize_token import lemmatize_token
|
||||||
|
from .match_names import match_names
|
||||||
|
from .matcher import fast_tokenize, filter_sentences, normalize
|
||||||
|
from .nlp import nlp
|
||||||
|
from .parallel_map import parallel_map
|
||||||
|
from .publication_tei import PublicationTEI
|
||||||
|
from .unique import unique
|
||||||
|
|
@ -14,9 +14,12 @@ def parallel_map(
|
||||||
function: Callable[[Any], Any],
|
function: Callable[[Any], Any],
|
||||||
values: Iterable[Any],
|
values: Iterable[Any],
|
||||||
chunk_size: Optional[int] = None,
|
chunk_size: Optional[int] = None,
|
||||||
concurrency: int = psutil.cpu_count(),
|
concurrency: Optional[int] = None,
|
||||||
disable_progress: bool = False,
|
disable_progress: bool = False,
|
||||||
) -> List[Any]:
|
) -> List[Any]:
|
||||||
|
if concurrency is None:
|
||||||
|
concurrency = psutil.cpu_count()
|
||||||
|
|
||||||
assert concurrency > 0
|
assert concurrency > 0
|
||||||
assert chunk_size is None or chunk_size > 0
|
assert chunk_size is None or chunk_size > 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue