spaCy - Util.itershuffle



This utility function was introduced in version 2.0, which will shuffle an iterator. This function is good for batching and works by holding the bufsize items back and yielding them sometimes later.

Arguments

The table below explains its arguments −

NAME TYPE DESCRIPTION
iterable iterable It represents the iterator to shuffle.
bufsize int This the buffer size for items to hold back. The default value is 1000.

Example

An example of util.itershuffle() function is as follows −

import spacy
value = range(1000)
shuffled_value = spacy.util.itershuffle(values)
shuffled_value

Output

The output is stated below −

<generator object itershuffle at 0x00000207BBBE4A20>
spacy_util_get_data_path.htm
Advertisements