Skip to content

Commit 9ff96d8

Browse files
committed
Use new property in parallel_text_corpus
1 parent c22faca commit 9ff96d8

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

machine/corpora/n_parallel_text_corpus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class NParallelTextCorpus(NParallelTextCorpusBase):
7979
def __init__(self, corpora: Sequence[TextCorpus], row_ref_comparer: Optional[Callable[[Any, Any], int]] = None):
8080
self._corpora = corpora
8181
self._row_ref_comparer = row_ref_comparer if row_ref_comparer is not None else default_row_ref_comparer
82-
self._all_rows: Sequence[bool] = [False for _ in range(len(corpora))]
82+
self._all_rows: List[bool] = [False for _ in range(len(corpora))]
8383

8484
def is_tokenized(self, i: int) -> bool:
8585
return self.corpora[i].is_tokenized
@@ -97,7 +97,7 @@ def row_ref_comparer(self) -> Callable[[Any, Any], int]:
9797
return self._row_ref_comparer
9898

9999
@property
100-
def all_rows(self) -> Sequence[bool]:
100+
def all_rows(self) -> List[bool]:
101101
return self._all_rows
102102

103103
def _get_text_ids_from_corpora(self) -> Set[str]:

machine/corpora/standard_parallel_text_corpus.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def __init__(
2727
self._all_source_rows = all_source_rows
2828
self._all_target_rows = all_target_rows
2929
self._n_parallel_text_corpus = NParallelTextCorpus([source_corpus, target_corpus])
30-
self._n_parallel_text_corpus._all_rows = [self._all_source_rows, self.all_target_rows]
30+
self._n_parallel_text_corpus.all_rows[0] = self.all_source_rows
31+
self._n_parallel_text_corpus.all_rows[1] = self.all_target_rows
3132
self._row_ref_comparer = row_ref_comparer or default_row_ref_comparer
3233

3334
@property

0 commit comments

Comments
 (0)