Beispiel #1
0
 private void loadTermDocsDocTerms(string sourceDirectory)
 {
     d.DocTermLoader dtl = new d.DocTermLoader(docTermCounts, termDocCounts);
     dtl.LoadFromTextFile(sourceDirectory + d.Helper.SOURCE_TERMDOCS_FILE);
     termDocs = dtl.GetTermDocItemCollection;
     docTerms = dtl.GetDocTermItemCollection;
 }
Beispiel #2
0
        private void runDocTermsTest(d.DocTermLoader loader)
        {
            d.DocTermItemCollection[] docTerms = loader.GetDocTermItemCollection;
            Assert.AreEqual(3, docTerms.Length);

            d.DocTermItem[] doc0terms = docTerms[doc0].DocTermItems;
            Assert.AreEqual(2, doc0terms.Length);
            Assert.AreEqual(term0, doc0terms[0].TermId);
            Assert.AreEqual(termCount00, doc0terms[0].TermCount);
            Assert.AreEqual(term1, doc0terms[1].TermId);
            Assert.AreEqual(termCount10, doc0terms[1].TermCount);

            d.DocTermItem[] doc1terms = docTerms[doc1].DocTermItems;
            Assert.AreEqual(2, doc1terms.Length);
            Assert.AreEqual(term0, doc1terms[0].TermId);
            Assert.AreEqual(termCount01, doc1terms[0].TermCount);
            Assert.AreEqual(term2, doc1terms[1].TermId);
            Assert.AreEqual(termCount21, doc1terms[1].TermCount);

            d.DocTermItem[] doc2terms = docTerms[doc2].DocTermItems;
            Assert.AreEqual(3, doc2terms.Length);
            Assert.AreEqual(term0, doc2terms[0].TermId);
            Assert.AreEqual(termCount02, doc2terms[0].TermCount);
            Assert.AreEqual(term1, doc2terms[1].TermId);
            Assert.AreEqual(termCount12, doc2terms[1].TermCount);
            Assert.AreEqual(term2, doc2terms[2].TermId);
            Assert.AreEqual(termCount22, doc2terms[2].TermCount);
        }
Beispiel #3
0
        private void runTermDocsTest(d.DocTermLoader loader)
        {
            d.TermDocItemCollection[] termDocs = loader.GetTermDocItemCollection;
            Assert.AreEqual(3, termDocs.Length);

            d.TermDocItem[] term0docs = termDocs[term0].TermDocItems;
            Assert.AreEqual(3, term0docs.Length);
            Assert.AreEqual(doc0, term0docs[0].DocId);
            Assert.AreEqual(termCount00, term0docs[0].TermCount);
            Assert.AreEqual(doc1, term0docs[1].DocId);
            Assert.AreEqual(termCount01, term0docs[1].TermCount);
            Assert.AreEqual(doc2, term0docs[2].DocId);
            Assert.AreEqual(termCount02, term0docs[2].TermCount);

            d.TermDocItem[] term1docs = termDocs[term1].TermDocItems;
            Assert.AreEqual(2, term1docs.Length);
            Assert.AreEqual(doc0, term1docs[0].DocId);
            Assert.AreEqual(termCount10, term1docs[0].TermCount);
            Assert.AreEqual(doc2, term1docs[1].DocId);
            Assert.AreEqual(termCount12, term1docs[1].TermCount);

            d.TermDocItem[] term2docs = termDocs[term2].TermDocItems;
            Assert.AreEqual(2, term2docs.Length);
            Assert.AreEqual(doc1, term2docs[0].DocId);
            Assert.AreEqual(termCount21, term2docs[0].TermCount);
            Assert.AreEqual(doc2, term2docs[1].DocId);
            Assert.AreEqual(termCount22, term2docs[1].TermCount);
        }
Beispiel #4
0
 public void TestLoadFromBinaryFile()
 {
     d.DocTermLoader loader = new d.DocTermLoader(new short[] { 2, 2, 3 }, new short[] { 3, 2, 2 });
     loader.LoadFromBinaryFile(rootPath + BINARY_FILE);
     runTermDocsTest(loader);
     //runDocTermsTest(loader);
 }
Beispiel #5
0
 public void TestLoadFromTextFile()
 {
     d.DocTermLoader loader = new d.DocTermLoader(new short[] { 2, 2, 3 }, new short[] { 3, 2, 2 });
     loader.LoadFromTextFile(rootPath + TEXT_FILE);
     runTermDocsTest(loader);
     runDocTermsTest(loader);
 }
Beispiel #6
0
        private void loadTermDocsDocTerms()
        {
            DocTermLoader dtl = new DocTermLoader(docTermCounts, termDocCounts);

            dtl.LoadFromBinaryFile(directoryPath + Helper.INDEX_TERMDOCS_FILE);
            termDocs = dtl.GetTermDocItemCollection;
            docTerms = dtl.GetDocTermItemCollection;
        }