# Buggy code
def diff(
    self, other, distance="kullback_leibler", num_words=100, n_ann_terms=10, normed=True
):
    """
    Calculate difference topic2topic between two Lda models
    `other` instances of `LdaMulticore` or `LdaModel`
    `distance` is function that will be applied to calculate difference between any topic pair.
    Available values: `kullback_leibler`, `hellinger` and `jaccard`
    `num_words` is quantity of most relevant words that used if distance == `jaccard` (also used for annotation)
    `n_ann_terms` is max quantity of words in intersection/symmetric difference between topics (used for annotation)
    Returns a matrix Z with shape (m1.num_topics, m2.num_topics), where Z[i][j] - difference between topic_i and topic_j
    and matrix annotation with shape (m1.num_topics, m2.num_topics, 2, None),
    where
        annotation[i][j] = [[`int_1`, `int_2`, ...], [`diff_1`, `diff_2`, ...]] and
        `int_k` is word from intersection of `topic_i` and `topic_j` and
        `diff_l` is word from symmetric difference of `topic_i` and `topic_j`
    `normed` is a flag. If `true`, matrix Z will be normalized
    Example:
    >>> m1, m2 = LdaMulticore.load(path_1), LdaMulticore.load(path_2)
    >>> mdiff, annotation = m1.diff(m2)
    >>> print(mdiff) # get matrix with difference for each topic pair from `m1` and `m2`
    >>> print(annotation) # get array with positive/negative words for each topic pair from `m1` and `m2`
    """

    distances = {
        "kullback_leibler": kullback_leibler,
        "hellinger": hellinger,
        "jaccard": jaccard_distance,
    }

    if distance not in distances:
        valid_keys = ", ".join("`{}`".format(x) for x in distances.keys())
        raise ValueError("Incorrect distance, valid only {}".format(valid_keys))

    if not isinstance(other, self.__class__):
        raise ValueError(
            "The parameter `other` must be of type `{}`".format(self.__name__)
        )

    distance_func = distances[distance]
    d1, d2 = self.state.get_lambda(), other.state.get_lambda()
    t1_size, t2_size = d1.shape[0], d2.shape[0]

    fst_topics = [
        {w for (w, _) in self.show_topic(topic, topn=num_words)}
        for topic in xrange(t1_size)
    ]
    snd_topics = [
        {w for (w, _) in other.show_topic(topic, topn=num_words)}
        for topic in xrange(t2_size)
    ]

    if distance == "jaccard":
        d1, d2 = fst_topics, snd_topics

    z = np.zeros((t1_size, t2_size))
    for topic1 in range(t1_size):
        for topic2 in range(t2_size):
            z[topic1][topic2] = distance_func(d1[topic1], d2[topic2])

    if normed:
        if np.abs(np.max(z)) > 1e-8:
            z /= np.max(z)

    annotation = [[None] * t1_size for _ in range(t2_size)]

    for topic1 in range(t1_size):
        for topic2 in range(t2_size):
            pos_tokens = fst_topics[topic1] & snd_topics[topic2]
            neg_tokens = fst_topics[topic1].symmetric_difference(snd_topics[topic2])

            pos_tokens = sample(pos_tokens, min(len(pos_tokens), n_ann_terms))
            neg_tokens = sample(neg_tokens, min(len(neg_tokens), n_ann_terms))

            annotation[topic1][topic2] = [pos_tokens, neg_tokens]

    return z, annotation


# Traceback (ImportError)
rm -rf _build/*
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 added, 0 changed, 0 removed
reading sources... [  1%] about
reading sources... [  2%] apiref
reading sources... [  3%] changes_080
reading sources... [  4%] corpora/bleicorpus
reading sources... [  6%] corpora/corpora
reading sources... [  7%] corpora/csvcorpus
reading sources... [  8%] corpora/dictionary
reading sources... [  9%] corpora/hashdictionary
reading sources... [ 10%] corpora/indexedcorpus
reading sources... [ 12%] corpora/lowcorpus
reading sources... [ 13%] corpora/malletcorpus
reading sources... [ 14%] corpora/mmcorpus
reading sources... [ 15%] corpora/sharded_corpus
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/signal/_max_len_seq.py:8: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  from ._max_len_seq_inner import _max_len_seq_inner
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/signal/_max_len_seq.py:8: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192, got 176
  from ._max_len_seq_inner import _max_len_seq_inner
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/signal/_upfirdn.py:36: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  from ._upfirdn_apply import _output_len, _apply
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/signal/_upfirdn.py:36: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192, got 176
  from ._upfirdn_apply import _output_len, _apply
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/spatial/__init__.py:93: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  from .ckdtree import *
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/spatial/__init__.py:93: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192, got 176
  from .ckdtree import *
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/spatial/__init__.py:94: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  from .qhull import *
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/spatial/__init__.py:94: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192, got 176
  from .qhull import *
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/ndimage/measurements.py:36: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  from . import _ni_label
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/ndimage/measurements.py:36: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192, got 176
  from . import _ni_label
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/signal/spectral.py:10: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  from ._spectral import lombscargle
/home/lev/miniconda2/lib/python2.7/site-packages/scipy/signal/spectral.py:10: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192, got 176
  from ._spectral import lombscargle
reading sources... [ 17%] corpora/svmlightcorpus
reading sources... [ 18%] corpora/textcorpus
reading sources... [ 19%] corpora/ucicorpus
reading sources... [ 20%] corpora/wikicorpus
reading sources... [ 21%] dist_lda
reading sources... [ 23%] dist_lsi
reading sources... [ 24%] distributed
reading sources... [ 25%] indextoc
reading sources... [ 26%] install
reading sources... [ 28%] interfaces
reading sources... [ 29%] intro
reading sources... [ 30%] matutils
reading sources... [ 31%] models/atmodel
reading sources... [ 32%] models/coherencemodel
reading sources... [ 34%] models/doc2vec
reading sources... [ 35%] models/hdpmodel
reading sources... [ 36%] models/keyedvectors
reading sources... [ 37%] models/lda_dispatcher
reading sources... [ 39%] models/lda_worker
reading sources... [ 40%] models/ldamodel
reading sources... [ 41%] models/ldamulticore
reading sources... [ 42%] models/ldaseqmodel
reading sources... [ 43%] models/logentropy_model
reading sources... [ 45%] models/lsi_dispatcher
reading sources... [ 46%] models/lsi_worker
reading sources... [ 47%] models/lsimodel
reading sources... [ 48%] models/models
reading sources... [ 50%] models/normmodel
reading sources... [ 51%] models/phrases
reading sources... [ 52%] models/rpmodel
reading sources... [ 53%] models/tfidfmodel
reading sources... [ 54%] models/word2vec
reading sources... [ 56%] models/wrappers/dtmmodel
reading sources... [ 57%] models/wrappers/fasttext
reading sources... [ 58%] models/wrappers/ldamallet
reading sources... [ 59%] models/wrappers/ldavowpalwabbit
reading sources... [ 60%] models/wrappers/varembed
reading sources... [ 62%] models/wrappers/wordrank
reading sources... [ 63%] models/wrappers/wrappers
reading sources... [ 64%] parsing/porter
reading sources... [ 65%] parsing/preprocessing
reading sources... [ 67%] scripts/glove2word2vec
reading sources... [ 68%] scripts/make_wikicorpus
reading sources... [ 69%] scripts/word2vec_standalone
reading sources... [ 70%] similarities/docsim
reading sources... [ 71%] similarities/index
reading sources... [ 73%] similarities/simserver
reading sources... [ 74%] simserver
reading sources... [ 75%] sklearn_integration/sklearn_wrapper_gensim_ldamodel
reading sources... [ 76%] summarization/bm25
reading sources... [ 78%] summarization/commons
reading sources... [ 79%] summarization/graph
reading sources... [ 80%] summarization/keywords
reading sources... [ 81%] summarization/pagerank_weighted
reading sources... [ 82%] summarization/summariser
reading sources... [ 84%] summarization/syntactic_unit
reading sources... [ 85%] summarization/textcleaner
reading sources... [ 86%] support
reading sources... [ 87%] topic_coherence/aggregation
reading sources... [ 89%] topic_coherence/direct_confirmation_measure
reading sources... [ 90%] topic_coherence/indirect_confirmation_measure
reading sources... [ 91%] topic_coherence/probability_estimation
reading sources... [ 92%] topic_coherence/segmentation
reading sources... [ 93%] tut1
reading sources... [ 95%] tut2
reading sources... [ 96%] tut3
reading sources... [ 97%] tutorial
reading sources... [ 98%] utils
reading sources... [100%] wiki

/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/corpora/malletcorpus.rst:2: WARNING: Title underline too short.

:mod:`corpora.malletcorpus` -- Corpus in Mallet format of List-Of-Words.
==========================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/corpora/sharded_corpus.rst:2: WARNING: Title underline too short.

:mod:`corpora.sharded_corpus` -- Corpus stored in separate files
==========================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/install.rst:118: WARNING: nonlocal image URI found: https://api.travis-ci.org/piskvorky/gensim.png?branch=develop
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/install.rst:118: WARNING: nonlocal image URI found: https://api.travis-ci.org/piskvorky/gensim.png?branch=develop
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/coherencemodel.py:docstring of gensim.models.coherencemodel:10: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/coherencemodel.py:docstring of gensim.models.coherencemodel:11: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/coherencemodel.py:docstring of gensim.models.coherencemodel.CoherenceModel:25: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/coherencemodel.py:docstring of gensim.models.coherencemodel.CoherenceModel:25: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/coherencemodel.py:docstring of gensim.models.coherencemodel.CoherenceModel:39: WARNING: Definition list ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/coherencemodel.py:docstring of gensim.models.coherencemodel.CoherenceModel:41: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/coherencemodel.py:docstring of gensim.models.coherencemodel.CoherenceModel:42: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/coherencemodel.py:docstring of gensim.models.coherencemodel.CoherenceModel:55: WARNING: Definition list ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/keyedvectors.py:docstring of gensim.models.keyedvectors.KeyedVectors.evaluate_word_pairs:1: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/keyedvectors.py:docstring of gensim.models.keyedvectors.KeyedVectors.evaluate_word_pairs:20: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/models/ldaseqmodel.rst:2: WARNING: Title underline too short.

:mod:`models.ldaseqmodel` -- Dynamic Topic Modeling in Python
================================
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/ldaseqmodel.py:docstring of gensim.models.ldaseqmodel.LdaSeqModel.fit_lda_seq:6: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/ldaseqmodel.py:docstring of gensim.models.ldaseqmodel.sslm.compute_post_variance:5: WARNING: Inline substitution_reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/ldaseqmodel.py:docstring of gensim.models.ldaseqmodel.sslm.compute_post_variance:8: WARNING: Inline substitution_reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/word2vec.py:docstring of gensim.models.word2vec:31: WARNING: Literal block expected; none found.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/word2vec.py:docstring of gensim.models.word2vec.Word2Vec.score:13: WARNING: duplicate citation taddy, other instance in /home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/models/doc2vec.rst
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/word2vec.py:docstring of gensim.models.word2vec.Word2Vec.score:14: WARNING: duplicate citation deepir, other instance in /home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/models/doc2vec.rst
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/dtmmodel.py:docstring of gensim.models.wrappers.dtmmodel.DtmModel.dtm_coherence:4: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/fasttext.py:docstring of gensim.models.wrappers.fasttext.FastTextKeyedVectors.evaluate_word_pairs:1: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/fasttext.py:docstring of gensim.models.wrappers.fasttext.FastTextKeyedVectors.evaluate_word_pairs:20: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/fasttext.py:docstring of gensim.models.wrappers.fasttext.FastText.score:13: WARNING: duplicate citation taddy, other instance in /home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/models/word2vec.rst
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/fasttext.py:docstring of gensim.models.wrappers.fasttext.FastText.score:14: WARNING: duplicate citation deepir, other instance in /home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/models/word2vec.rst
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/ldamallet.py:docstring of gensim.models.wrappers.ldamallet.malletmodel2ldamodel:6: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/ldamallet.py:docstring of gensim.models.wrappers.ldamallet.malletmodel2ldamodel:6: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/ldamallet.py:docstring of gensim.models.wrappers.ldamallet.malletmodel2ldamodel:12: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/ldamallet.py:docstring of gensim.models.wrappers.ldamallet.malletmodel2ldamodel:12: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/ldavowpalwabbit.py:docstring of gensim.models.wrappers.ldavowpalwabbit.vwmodel2ldamodel:6: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/ldavowpalwabbit.py:docstring of gensim.models.wrappers.ldavowpalwabbit.vwmodel2ldamodel:6: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/ldavowpalwabbit.py:docstring of gensim.models.wrappers.ldavowpalwabbit.vwmodel2ldamodel:11: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/ldavowpalwabbit.py:docstring of gensim.models.wrappers.ldavowpalwabbit.vwmodel2ldamodel:11: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/varembed.py:docstring of gensim.models.wrappers.varembed.VarEmbed.evaluate_word_pairs:1: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/varembed.py:docstring of gensim.models.wrappers.varembed.VarEmbed.evaluate_word_pairs:20: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/wordrank.py:docstring of gensim.models.wrappers.wordrank.Wordrank.evaluate_word_pairs:1: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/models/wrappers/wordrank.py:docstring of gensim.models.wrappers.wordrank.Wordrank.evaluate_word_pairs:20: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/parsing/preprocessing.rst:2: WARNING: Title underline too short.

:mod:`parsing.preprocessing` -- Functions to preprocess raw text
=========================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/scripts/glove2word2vec.rst:2: WARNING: Title underline too short.

:mod:`scripts.glove2word2vec` -- Convert glove format to word2vec
=========================================================
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/scripts/glove2word2vec.py:docstring of gensim.scripts.glove2word2vec:3: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/scripts/glove2word2vec.py:docstring of gensim.scripts.glove2word2vec.glove2word2vec:1: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/scripts/make_wikicorpus.rst:2: WARNING: Title underline too short.

:mod:`scripts.make_wikicorpus` -- Convert articles from a Wikipedia dump to vectors.
=========================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/scripts/word2vec_standalone.rst:2: WARNING: Title underline too short.

:mod:`scripts.word2vec_standalone` -- Train word2vec on text file CORPUS
=========================================================
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/similarities/docsim.py:docstring of gensim.similarities.docsim.WmdSimilarity:28: ERROR: Unexpected indentation.
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/similarities/index.rst:2: WARNING: Title underline too short.

:mod:`similarities.index` -- Fast Approximate Nearest Neighbor Similarity with Annoy package
========================================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/similarities/simserver.rst:4: WARNING: autodoc: failed to import module u'simserver.simserver'; the following exception was raised:
Traceback (most recent call last):
  File "/home/lev/miniconda2/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 551, in import_object
    __import__(self.modname)
ImportError: No module named simserver.simserver
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/sklearn_integration/sklearn_wrapper_gensim_ldamodel.rst:2: WARNING: Title underline too short.

:mod:`sklearn_integration.sklearn_wrapper_gensim_ldamodel.SklearnWrapperLdaModel` -- Scikit learn wrapper for Latent Dirichlet Allocation
======================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/sklearn_integration/sklearn_wrapper_gensim_ldamodel.rst:4: WARNING: autodoc: failed to import module u'gensim.sklearn_integration.sklearn_wrapper_gensim_ldamodel.SklearnWrapperLdaModel'; the following exception was raised:
Traceback (most recent call last):
  File "/home/lev/miniconda2/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 551, in import_object
    __import__(self.modname)
ImportError: No module named SklearnWrapperLdaModel
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/summarization/keywords.rst:2: WARNING: Title underline too short.

:mod:`summarization.keywords` -- Keywords for TextRank summarization algorithm
=========================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/summarization/pagerank_weighted.rst:2: WARNING: Title underline too short.

:mod:`summarization.pagerank_weighted` -- Weighted PageRank algorithm
=========================================================
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/summarization/summarizer.py:docstring of gensim.summarization.summarizer.summarize:13: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/summarization/summarizer.py:docstring of gensim.summarization.summarizer.summarize:14: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/summarization/summarizer.py:docstring of gensim.summarization.summarizer.summarize:16: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/summarization/summarizer.py:docstring of gensim.summarization.summarizer.summarize:17: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/summarization/syntactic_unit.rst:2: WARNING: Title underline too short.

:mod:`summarization.syntactic_unit` -- Syntactic Unit class
=========================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/summarization/textcleaner.rst:2: WARNING: Title underline too short.

:mod:`summarization.textcleaner` -- Summarization pre-processing
=========================================================
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/summarization/textcleaner.rst:10: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/aggregation.py:docstring of gensim.topic_coherence.aggregation.arithmetic_mean:5: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/aggregation.py:docstring of gensim.topic_coherence.aggregation.arithmetic_mean:5: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/aggregation.py:docstring of gensim.topic_coherence.aggregation.arithmetic_mean:9: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/aggregation.py:docstring of gensim.topic_coherence.aggregation.arithmetic_mean:9: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/direct_confirmation_measure.py:docstring of gensim.topic_coherence.direct_confirmation_measure.log_conditional_probability:6: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/direct_confirmation_measure.py:docstring of gensim.topic_coherence.direct_confirmation_measure.log_conditional_probability:6: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/direct_confirmation_measure.py:docstring of gensim.topic_coherence.direct_confirmation_measure.log_conditional_probability:12: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/direct_confirmation_measure.py:docstring of gensim.topic_coherence.direct_confirmation_measure.log_conditional_probability:12: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/direct_confirmation_measure.py:docstring of gensim.topic_coherence.direct_confirmation_measure.log_ratio_measure:13: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/direct_confirmation_measure.py:docstring of gensim.topic_coherence.direct_confirmation_measure.log_ratio_measure:13: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/direct_confirmation_measure.py:docstring of gensim.topic_coherence.direct_confirmation_measure.log_ratio_measure:19: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/direct_confirmation_measure.py:docstring of gensim.topic_coherence.direct_confirmation_measure.log_ratio_measure:19: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/indirect_confirmation_measure.py:docstring of gensim.topic_coherence.indirect_confirmation_measure.cosine_similarity:4: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/indirect_confirmation_measure.py:docstring of gensim.topic_coherence.indirect_confirmation_measure.cosine_similarity:5: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/indirect_confirmation_measure.py:docstring of gensim.topic_coherence.indirect_confirmation_measure.cosine_similarity:8: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/indirect_confirmation_measure.py:docstring of gensim.topic_coherence.indirect_confirmation_measure.cosine_similarity:12: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/indirect_confirmation_measure.py:docstring of gensim.topic_coherence.indirect_confirmation_measure.cosine_similarity:15: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/indirect_confirmation_measure.py:docstring of gensim.topic_coherence.indirect_confirmation_measure.cosine_similarity:15: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/indirect_confirmation_measure.py:docstring of gensim.topic_coherence.indirect_confirmation_measure.cosine_similarity:24: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/indirect_confirmation_measure.py:docstring of gensim.topic_coherence.indirect_confirmation_measure.cosine_similarity:24: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/probability_estimation.py:docstring of gensim.topic_coherence.probability_estimation.p_boolean_document:5: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/probability_estimation.py:docstring of gensim.topic_coherence.probability_estimation.p_boolean_document:5: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/probability_estimation.py:docstring of gensim.topic_coherence.probability_estimation.p_boolean_document:10: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/probability_estimation.py:docstring of gensim.topic_coherence.probability_estimation.p_boolean_document:10: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/probability_estimation.py:docstring of gensim.topic_coherence.probability_estimation.p_boolean_sliding_window:7: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/probability_estimation.py:docstring of gensim.topic_coherence.probability_estimation.p_boolean_sliding_window:7: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/probability_estimation.py:docstring of gensim.topic_coherence.probability_estimation.p_boolean_sliding_window:14: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/probability_estimation.py:docstring of gensim.topic_coherence.probability_estimation.p_boolean_sliding_window:14: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_one:3: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_one:4: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_one:11: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_one:11: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_one:15: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_one:15: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_pre:3: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_pre:4: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_pre:11: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_pre:11: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_pre:15: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_pre:15: SEVERE: Unexpected section title.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_set:3: ERROR: Unexpected indentation.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_set:4: WARNING: Block quote ends without a blank line; unexpected unindent.
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_set:12: WARNING: Title underline too short.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_set:12: SEVERE: Unexpected section title.

Args:
----
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_set:16: WARNING: Title underline too short.

Returns:
-------
/home/lev/miniconda2/lib/python2.7/site-packages/gensim-1.0.1-py2.7-linux-x86_64.egg/gensim/topic_coherence/segmentation.py:docstring of gensim.topic_coherence.segmentation.s_one_set:16: SEVERE: Unexpected section title.

Returns:
-------
looking for now-outdated files... none found
pickling environment... done
checking consistency... /home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/about.rst:: WARNING: document isn't included in any toctree
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/changes_080.rst:: WARNING: document isn't included in any toctree
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/corpora/corpora.rst:: WARNING: document isn't included in any toctree
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/models/models.rst:: WARNING: document isn't included in any toctree
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/models/wrappers/wrappers.rst:: WARNING: document isn't included in any toctree
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/similarities/simserver.rst:: WARNING: document isn't included in any toctree
/home/lev/Dropbox/raretech/os/release/fix/gensim/docs/src/simserver.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [  1%] about
writing output... [  2%] apiref
writing output... [  3%] changes_080
writing output... [  4%] corpora/bleicorpus
writing output... [  6%] corpora/corpora
writing output... [  7%] corpora/csvcorpus
writing output... [  8%] corpora/dictionary
writing output... [  9%] corpora/hashdictionary
writing output... [ 10%] corpora/indexedcorpus
writing output... [ 12%] corpora/lowcorpus
writing output... [ 13%] corpora/malletcorpus
writing output... [ 14%] corpora/mmcorpus
writing output... [ 15%] corpora/sharded_corpus
writing output... [ 17%] corpora/svmlightcorpus
writing output... [ 18%] corpora/textcorpus
writing output... [ 19%] corpora/ucicorpus
writing output... [ 20%] corpora/wikicorpus
writing output... [ 21%] dist_lda
writing output... [ 23%] dist_lsi
writing output... [ 24%] distributed
writing output... [ 25%] indextoc
writing output... [ 26%] install
writing output... [ 28%] interfaces
writing output... [ 29%] intro
writing output... [ 30%] matutils
writing output... [ 31%] models/atmodel
writing output... [ 32%] models/coherencemodel
writing output... [ 34%] models/doc2vec
writing output... [ 35%] models/hdpmodel
writing output... [ 36%] models/keyedvectors
writing output... [ 37%] models/lda_dispatcher
writing output... [ 39%] models/lda_worker
writing output... [ 40%] models/ldamodel
writing output... [ 41%] models/ldamulticore
writing output... [ 42%] models/ldaseqmodel
writing output... [ 43%] models/logentropy_model
writing output... [ 45%] models/lsi_dispatcher
writing output... [ 46%] models/lsi_worker
writing output... [ 47%] models/lsimodel
writing output... [ 48%] models/models
writing output... [ 50%] models/normmodel
writing output... [ 51%] models/phrases
writing output... [ 52%] models/rpmodel
writing output... [ 53%] models/tfidfmodel
writing output... [ 54%] models/word2vec
writing output... [ 56%] models/wrappers/dtmmodel
writing output... [ 57%] models/wrappers/fasttext
writing output... [ 58%] models/wrappers/ldamallet
writing output... [ 59%] models/wrappers/ldavowpalwabbit
writing output... [ 60%] models/wrappers/varembed
writing output... [ 62%] models/wrappers/wordrank
writing output... [ 63%] models/wrappers/wrappers
writing output... [ 64%] parsing/porter
writing output... [ 65%] parsing/preprocessing
writing output... [ 67%] scripts/glove2word2vec
writing output... [ 68%] scripts/make_wikicorpus
writing output... [ 69%] scripts/word2vec_standalone
writing output... [ 70%] similarities/docsim
writing output... [ 71%] similarities/index
writing output... [ 73%] similarities/simserver
writing output... [ 74%] simserver
writing output... [ 75%] sklearn_integration/sklearn_wrapper_gensim_ldamodel
writing output... [ 76%] summarization/bm25
writing output... [ 78%] summarization/commons
writing output... [ 79%] summarization/graph
writing output... [ 80%] summarization/keywords
writing output... [ 81%] summarization/pagerank_weighted
writing output... [ 82%] summarization/summariser
writing output... [ 84%] summarization/syntactic_unit
writing output... [ 85%] summarization/textcleaner
writing output... [ 86%] support
writing output... [ 87%] topic_coherence/aggregation
writing output... [ 89%] topic_coherence/direct_confirmation_measure
writing output... [ 90%] topic_coherence/indirect_confirmation_measure
writing output... [ 91%] topic_coherence/probability_estimation
writing output... [ 92%] topic_coherence/segmentation
writing output... [ 93%] tut1
writing output... [ 95%] tut2
writing output... [ 96%] tut3
writing output... [ 97%] tutorial
writing output... [ 98%] utils
writing output... [100%] wiki

generating indices... genindex
writing additional pages... index search
copying static files... WARNING: favicon file 'favicon.ico' does not exist
done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 112 warnings.
rm -r _build/html/_sources
cp -r _build/html/* ../

Build finished. The HTML pages are in ../


# Fixed code
def diff(
    self, other, distance="kullback_leibler", num_words=100, n_ann_terms=10, normed=True
):
    """
    Calculate difference topic2topic between two Lda models
    `other` instances of `LdaMulticore` or `LdaModel`
    `distance` is function that will be applied to calculate difference between any topic pair.
    Available values: `kullback_leibler`, `hellinger` and `jaccard`
    `num_words` is quantity of most relevant words that used if distance == `jaccard` (also used for annotation)
    `n_ann_terms` is max quantity of words in intersection/symmetric difference between topics (used for annotation)
    Returns a matrix Z with shape (m1.num_topics, m2.num_topics), where Z[i][j] - difference between topic_i and topic_j
    and matrix annotation with shape (m1.num_topics, m2.num_topics, 2, None),
    where:

        annotation[i][j] = [[`int_1`, `int_2`, ...], [`diff_1`, `diff_2`, ...]] and
        `int_k` is word from intersection of `topic_i` and `topic_j` and
        `diff_l` is word from symmetric difference of `topic_i` and `topic_j`
        `normed` is a flag. If `true`, matrix Z will be normalized

    Example:

    >>> m1, m2 = LdaMulticore.load(path_1), LdaMulticore.load(path_2)
    >>> mdiff, annotation = m1.diff(m2)
    >>> print(mdiff) # get matrix with difference for each topic pair from `m1` and `m2`
    >>> print(annotation) # get array with positive/negative words for each topic pair from `m1` and `m2`

    """

    distances = {
        "kullback_leibler": kullback_leibler,
        "hellinger": hellinger,
        "jaccard": jaccard_distance,
    }

    if distance not in distances:
        valid_keys = ", ".join("`{}`".format(x) for x in distances.keys())
        raise ValueError("Incorrect distance, valid only {}".format(valid_keys))

    if not isinstance(other, self.__class__):
        raise ValueError(
            "The parameter `other` must be of type `{}`".format(self.__name__)
        )

    distance_func = distances[distance]
    d1, d2 = self.state.get_lambda(), other.state.get_lambda()
    t1_size, t2_size = d1.shape[0], d2.shape[0]

    fst_topics = [
        {w for (w, _) in self.show_topic(topic, topn=num_words)}
        for topic in xrange(t1_size)
    ]
    snd_topics = [
        {w for (w, _) in other.show_topic(topic, topn=num_words)}
        for topic in xrange(t2_size)
    ]

    if distance == "jaccard":
        d1, d2 = fst_topics, snd_topics

    z = np.zeros((t1_size, t2_size))
    for topic1 in range(t1_size):
        for topic2 in range(t2_size):
            z[topic1][topic2] = distance_func(d1[topic1], d2[topic2])

    if normed:
        if np.abs(np.max(z)) > 1e-8:
            z /= np.max(z)

    annotation = [[None] * t1_size for _ in range(t2_size)]

    for topic1 in range(t1_size):
        for topic2 in range(t2_size):
            pos_tokens = fst_topics[topic1] & snd_topics[topic2]
            neg_tokens = fst_topics[topic1].symmetric_difference(snd_topics[topic2])

            pos_tokens = sample(pos_tokens, min(len(pos_tokens), n_ann_terms))
            neg_tokens = sample(neg_tokens, min(len(neg_tokens), n_ann_terms))

            annotation[topic1][topic2] = [pos_tokens, neg_tokens]

    return z, annotation