Functions for splitting lists and arrays
def vsm.split.mp_split_ls |
( |
|
ls, |
|
|
|
n |
|
) |
| |
Split list into an `n`-length list of arrays.
:param ls: List to be split.
:type ls: list
:param n: Number of splits.
:type n: int
:returns: List of arrays whose length is 'n'.
**Examples**
>>> ls = [1,5,6,8,2,8]
>>> mp_split_ls(ls, 4)
[array([1, 5]), array([6, 8]), array([2]), array([8])]
def vsm.split.split_corpus |
( |
|
arr, |
|
|
|
indices |
|
) |
| |
Splits the given array by the indices into list of sub-arrays.
:param arr: An array to be split.
:type arr: array
:param indices: 1-dimensional array of integers that indicates
where the array is split.
:type indices: array
:returns: A list of sub-arrays split at the indices.
**Examples**
>>> arr = np.arange(8)
>>> indices = np.array([2,4,7])
>>> split_corpus(arr, indices)
[array([0,1]), array([2,3]), array([4,5,6]), array([7])]