示例#1
0
        private void ExpandSimilars()
        {
            FeatureTrackingManager.Instance.UseFeature(Features.Brainstorm_ExploreLibrary_Document_Similars);

            if (null != pdf_document_node_content.PDFDocument.Library.ExpeditionManager)
            {
                ExpeditionDataSource eds = pdf_document_node_content.PDFDocument.Library.ExpeditionManager.ExpeditionDataSource;
                if (null != eds)
                {
                    if (eds.docs_index.ContainsKey(pdf_document_node_content.PDFDocument.Fingerprint))
                    {
                        int doc_id = eds.docs_index[pdf_document_node_content.PDFDocument.Fingerprint];
                        float[,] density_of_topics_in_docs = eds.LDAAnalysis.DensityOfTopicsInDocuments;

                        float[] distribution = new float[eds.LDAAnalysis.NUM_TOPICS];
                        for (int topic_i = 0; topic_i < eds.LDAAnalysis.NUM_TOPICS; ++topic_i)
                        {
                            distribution[topic_i] = density_of_topics_in_docs[doc_id, topic_i];
                        }

                        ThemeNodeContentControl.AddDocumentsSimilarToDistribution(node_control, pdf_document_node_content.PDFDocument.Library, eds, distribution);
                    }
                }
            }
        }
示例#2
0
        private static void ExpandSimilars(PDFDocument doc, NodeControl node_control)
        {
            WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread();
            ASSERT.Test(doc != null);

            FeatureTrackingManager.Instance.UseFeature(Features.Brainstorm_ExploreLibrary_Document_Similars);

            if (doc != null)
            {
                ASSERT.Test(doc.LibraryRef.Xlibrary != null);

                ExpeditionDataSource eds = doc.LibraryRef.Xlibrary?.ExpeditionManager?.ExpeditionDataSource;
                if (null != eds)
                {
                    if (eds.docs_index.ContainsKey(doc.Fingerprint))
                    {
                        int         doc_id = eds.docs_index[doc.Fingerprint];
                        LDAAnalysis lda    = eds.LDAAnalysis;

                        float[,] density_of_topics_in_docs = lda.DensityOfTopicsInDocuments;

                        float[] distribution = new float[lda.NUM_TOPICS];
                        for (int topic_i = 0; topic_i < lda.NUM_TOPICS; ++topic_i)
                        {
                            distribution[topic_i] = density_of_topics_in_docs[doc_id, topic_i];
                        }

                        ThemeNodeContentControl.AddDocumentsSimilarToDistribution(node_control, doc.LibraryRef, eds, distribution);
                    }
                }
                else
                {
                    Logging.Warn("Expedition has not been run for library '{0}'.", doc.LibraryRef.Title);
                }
            }
        }