def compact_to_coocurrence(self, word_compact, indices, window_size=10):
        tokens = pd.DataFrame(dict(word_index=word_compact)).reset_index()
        for name, index in indices.items():
            tokens[name] = index
        a, b = tokens.copy(), tokens.copy()
        mask = lambda x: np.prod([x[k + '_x'] == x[k + '_y']
                                  for k in indices.keys()], axis=0)
        group_keys = ['word_index_x', 'word_index_y', ]
        group_keys += [k + '_x' for k in indices.keys()]
        total = []
        a['frame'] = a['index'].copy()
        for frame in range(-window_size, window_size + 1):
            if frame == 0:
                continue
            b['frame'] = b['index'] + frame
            matches = (a.merge(b, on='frame')
                        .assign(same_doc=mask)
                        .pipe(lambda df: df[df['same_doc'] == 1])
                        .groupby(group_keys)['frame']
                        .count()
                        .reset_index())
            total.append(matches)
        counts = (pd.concat(total)
                    .groupby(group_keys)['frame']
                    .sum()
                    .reset_index()
                    .rename(columns={k + '_x': k for k in indices.keys()})
                    .rename(columns=dict(frame='counts')))
        return counts
OS-specific conversion from a file system path to a relative URL
dataset/ETHPy150Open cemoody/lda2vec/lda2vec/corpus.py/Corpus.compact_to_coocurrence--crossover with--dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/win32/Python27/Lib/urllib.py/pathname2url