⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basicindexreader.java

📁 dragontoolkit用于机器学习
💻 JAVA
字号:
package dragon.ir.index;

import dragon.matrix.*;
import dragon.nlp.*;
import dragon.onlinedb.CollectionReader;
import java.io.File;

/**
 * <p>BasicIndexReader is used to read all the indexing information into memory for a indexed collection </p>
 * <p> </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: IST, Drexel University</p>
 * @author Davis Zhou
 * @version 1.0
 */

public class BasicIndexReader  extends AbstractIndexReader {
    private FileIndex fileIndex;

    public BasicIndexReader(String directory, boolean relationSupported) {
        this(directory,relationSupported,null);
    }

    public BasicIndexReader(String directory, boolean relationSupported, CollectionReader collectionReader) {
        super(relationSupported);
        this.relationSupported = relationSupported;
        this.collectionReader =collectionReader;
        fileIndex=new FileIndex(directory,relationSupported);
    }

    public void initialize() {
        collection = new IRCollection();
        collection.load(fileIndex.getCollectionFilename());
        termIndexList = new BasicIRTermIndexList(fileIndex.getTermIndexListFilename(),false);
        docIndexList = new BasicIRDocIndexList(fileIndex.getDocIndexListFilename(), false);
        termdocMatrix = new IntSuperSparseMatrix(fileIndex.getTermDocIndexFilename(), fileIndex.getTermDocFilename());
        doctermMatrix = new IntGiantSparseMatrix(fileIndex.getDocTermIndexFilename(), fileIndex.getDocTermFilename());
        if((new File(fileIndex.getDocKeyListFilename())).exists())
            docKeyList=new SimpleElementList(fileIndex.getDocKeyListFilename(),false);
        if((new File(fileIndex.getTermKeyListFilename())).exists())
            termKeyList=new SimpleElementList(fileIndex.getTermKeyListFilename(),false);
        if (relationSupported) {
            relationIndexList = new BasicIRRelationIndexList(fileIndex.getRelationIndexListFilename(), false);
            relationdocMatrix = new IntGiantSparseMatrix(fileIndex.getRelationDocIndexFilename(), fileIndex.getRelationDocFilename());
            docrelationMatrix = new IntGiantSparseMatrix(fileIndex.getDocRelationIndexFilename(), fileIndex.getDocRelationFilename());
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -