Return the aligned targetwords for a specified index in the source words
514925
def targetwords(self, index, targetwords, alignment):
        """"""
        return [ targetwords[x] for x in alignment[index] ]
519718
private int matchAnyToOne(final int wordIndex, final int candIndex) {
    if (replacementsAnyToOne.containsKey(candidate[candIndex])) {
      for (final char[] rep : replacementsAnyToOne.get(candidate[candIndex])) {
        int i = 0;
        while (i < rep.length && (wordIndex + i) < wordLen && rep[i] == wordProcessed[wordIndex + i]) {
          i++;
        }
        if (i == rep.length) {
          return i;
        }
      }
    }
    return 0;
  }
1095162
def get_parameter(self, index):
        
        result = []
        for target in self.targets:
            if target is not None:
                result.append(target.get_parameter(index))

        return result
178152
def _get_fill_indexer_searchsorted(self, target, method, limit=None):
        
        if limit is not None:
            raise ValueError('limit argument for %r method only well-defined '
                             'if index and target are monotonic' % method)

        side = 'left' if method == 'pad' else 'right'

        # find exact matches first (this simplifies the algorithm)
        indexer = self.get_indexer(target)
        nonexact = (indexer == -1)
        indexer[nonexact] = self._searchsorted_monotonic(target[nonexact],
                                                         side)
        if side == 'left':
            # searchsorted returns "indices into a sorted array such that,
            # if the corresponding elements in v were inserted before the
            # indices, the order of a would be preserved".
            # Thus, we need to subtract 1 to find values to the left.
            indexer[nonexact] -= 1
            # This also mapped not found values (values of 0 from
            # np.searchsorted) to -1, which conveniently is also our
            # sentinel for missing values
        else:
            # Mark indices to the right of the largest value as not found
            indexer[indexer == len(self)] = -1
        return indexer
761047
public static int indexAny(String target, Integer fromIndex, String... indexWith) {
		return indexAny(target, fromIndex, Arrays.asList(indexWith));
	}
1244684
def _commonWordStart(self, words):
        
        if not words:
            return ''

        length = 0
        firstWord = words[0]
        otherWords = words[1:]
        for index, char in enumerate(firstWord):
            if not all([word[index] == char for word in otherWords]):
                break
            length = index + 1

        return firstWord[:length]
1359057
def __get_idxs(self, words):
        """"""
        if self.bow:
            return list(itertools.chain.from_iterable(
                [self.positions[z] for z in words]))
        else:
            return self.positions[words]
12838
def get_lexicons(self, num_terms=10):
        '''
        
        '''
        return {k: v.index[:num_terms]
                for k, v in self.lexicons.items()}
522008
def regex_matches_to_indexed_words(matches):
    
    words = [dict(v, **dict([('sentence', i)]))
             for i, s in enumerate(matches['sentences'])
             for k, v in s.items() if k != 'length']
    return words
759114
def get_word_at(self, index: int) -> Union[int, BitVec]:
        
        try:
            return symbol_factory.BitVecVal(
                util.concrete_int_from_bytes(
                    bytes([util.get_concrete_int(b) for b in self[index : index + 32]]),
                    0,
                ),
                256,
            )
        except TypeError:
            result = simplify(
                Concat(
                    [
                        b if isinstance(b, BitVec) else symbol_factory.BitVecVal(b, 8)
                        for b in cast(
                            List[Union[int, BitVec]], self[index : index + 32]
                        )
                    ]
                )
            )
            assert result.size() == 256
            return result
185592
function createWordIndex(exampleData) {
  const index = {};
  const keys = ['shortdesc', 'title', 'tags'];
  exampleData.forEach((data, i) => {
    keys.forEach(key => {
      let text = data[key];
      if (Array.isArray(text)) {
        text = text.join(' ');
      }
      const words = text ? text.split(/\W+/) : [];
      words.forEach(word => {
        if (word) {
          word = word.toLowerCase();
          let counts = index[word];
          if (counts) {
            if (index in counts) {
              counts[i] += 1;
            } else {
              counts[i] = 1;
            }
          } else {
            counts = {};
            counts[i] = 1;
            index[word] = counts;
          }
        }
      });
    });
  });
  return index;
}
432057
def iteritems(self):
        
        for m in self.mappings:
            yield self.indexes[m.clause][m.target], m
239073
def get_word_at(self, offset: int) -> Expression:
        
        parts = self[offset : offset + 32]
        return simplify(Concat(parts))
458536
private void outputIndexEntryEclipseIndexsee(final IndexTerm term,
            final XMLStreamWriter serializer) throws XMLStreamException {
        final List<IndexTermTarget> targets = term.getTargetList();

        // Index-see and index-see-also terms should also generate links to its
        // target
        // Otherwise, the term won't be displayed in the index tab.
        if (!targets.isEmpty()) {
            for (final IndexTermTarget target : targets) {
                final String targetUri = target.getTargetURI();
                final String targetName = target.getTargetName();
                if (targetUri == null) {
                    serializer.writeStartElement("topic");
                    serializer.writeAttribute("title", target.getTargetName());
                    serializer.writeEndElement(); // topic
                } else {
                    serializer.writeStartElement("topic");
                    serializer.writeAttribute("href", replaceExtName(targetUri));

                    if (targetName.trim().length() > 0) {
                        serializer.writeAttribute("title", target.getTargetName());
                    }
                    serializer.writeEndElement(); // topic
                }
            }
        }// end for
    }
1020515
def get_targets(self, raw_string):
        # type: (Optional[Text]) -> Dict[Text, Text]
        
        targets = {}
        if raw_string is not None:
            for line in raw_string.splitlines():
                if line:
                    target, directory = line.split(':', 1)
                    targets[target.strip()] = directory.strip()
        return targets
538678
def get_index_labels(self, targets):
        
        target_ind = self.graph.vs.select(name_in=targets).indices
        rest_ind = self.graph.vs.select(name_notin=targets).indices
        label_mappings = {i: 1 for i in target_ind}
        label_mappings.update({i: 0 for i in rest_ind})
        return label_mappings
680093
def _zom_index(lexer):
    """"""
    tok = next(lexer)
    # ',' INT
    if isinstance(tok, COMMA):
        first = _expect_token(lexer, {IntegerToken}).value
        rest = _zom_index(lexer)
        return (first, ) + rest
    # null
    else:
        lexer.unpop_token(tok)
        return tuple()