Replace cytoolz.partition_all with util.minibatch

This commit is contained in:
Ines Montani 2019-05-11 21:12:09 +02:00
parent 0bf6441863
commit aea1c93a05
1 changed files with 2 additions and 2 deletions

View File

@ -2,9 +2,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
from cytoolz import partition_all
from ...gold import iob_to_biluo from ...gold import iob_to_biluo
from ...util import minibatch
def iob2json(input_data, n_sents=10, *args, **kwargs): def iob2json(input_data, n_sents=10, *args, **kwargs):
@ -46,7 +46,7 @@ def read_iob(raw_sents):
def merge_sentences(docs, n_sents): def merge_sentences(docs, n_sents):
merged = [] merged = []
for group in partition_all(n_sents, docs): for group in minibatch(docs, size=n_sents):
group = list(group) group = list(group)
first = group.pop(0) first = group.pop(0)
to_extend = first["paragraphs"][0]["sentences"] to_extend = first["paragraphs"][0]["sentences"]