Convert the indices in `indices` to their word values. If an index is not in the vocabulary, return the `` `` token. Parameters ---------- indices : list of ints The token indices for each word in `words` Returns -------
(self, indices)
| 1146 | return [self.token2idx[w] if w in self else unk_ix for w in words] |
| 1147 | |
| 1148 | def indices_to_words(self, indices): |
| 1149 | """ |
| 1150 | Convert the indices in `indices` to their word values. If an index is |
| 1151 | not in the vocabulary, return the ``<unk>`` token. |
| 1152 | |
| 1153 | Parameters |
| 1154 | ---------- |
| 1155 | indices : list of ints |
| 1156 | The token indices for each word in `words` |
| 1157 | |
| 1158 | Returns |
| 1159 | ------- |
| 1160 | words : list of strs |
| 1161 | The word strings corresponding to each token index in `indices` |
| 1162 | """ |
| 1163 | unk = "<unk>" |
| 1164 | return [self.idx2token[i] if i in self.idx2token else unk for i in indices] |
| 1165 | |
| 1166 | def fit(self, corpus_fps, encoding="utf-8-sig"): |
| 1167 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected