当前位置: 首页>>代码示例>>Java>>正文


Java Retrieval类代码示例

本文整理汇总了Java中org.galagosearch.core.retrieval.Retrieval的典型用法代码示例。如果您正苦于以下问题:Java Retrieval类的具体用法?Java Retrieval怎么用?Java Retrieval使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Retrieval类属于org.galagosearch.core.retrieval包,在下文中一共展示了Retrieval类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleSearch

import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
private static void handleSearch(String[] args) throws Exception {
    if (args.length <= 1) {
        commandHelp("search");
        return;
    }

    String indexPath = args[1];
    String[][] filtered = Utility.filterFlags(Utility.subarray(args, 2));
    String[] flags = filtered[0];
    String[] corpusFiles = filtered[1];

    // Any flag marked '--parameters' marks a parameters file.
    // We trim that part of the flag off so that the Parameters object will
    // load it as a parameters file.
    for (int i = 0; i < flags.length; ++i) {
        flags[i] = flags[i].replace("--parameters=", "");
    }

    Parameters p = new Parameters(flags);
    Retrieval retrieval = Retrieval.instance(indexPath, p);
    handleSearch(retrieval, getDocumentStore(corpusFiles));
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:23,代码来源:App.java

示例2: handleSearch

import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
private void handleSearch(String[] args) throws Exception {
    if (args.length <= 1) {
        commandHelp("search");
        return;
    }

    String indexPath = args[1];
    String[][] filtered = Utility.filterFlags(Utility.subarray(args, 2));
    String[] flags = filtered[0];
    String[] corpusFiles = filtered[1];

    // Any flag marked '--parameters' marks a parameters file.
    // We trim that part of the flag off so that the Parameters object will
    // load it as a parameters file.
    for (int i = 0; i < flags.length; ++i) {
        flags[i] = flags[i].replace("--parameters=", "");
    }

    Parameters p = new Parameters(flags);
    Retrieval retrieval = Retrieval.instance(indexPath, p);
    handleSearch(retrieval, getDocumentStore(corpusFiles));
}
 
开发者ID:youngilcho,项目名称:internet-application-2014,代码行数:23,代码来源:App.java

示例3: main

import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    // read in parameters
    Parameters parameters = new Parameters(args);
    List<Parameters.Value> queries = parameters.list("query");

    // open index
    Retrieval retrieval = Retrieval.instance(parameters.get("index"), parameters);

    // record results requested
    int requested = (int) parameters.get("count", 1000);

    // for each query, run it, get the results, look up the docnos, print in TREC format
    for (Parameters.Value query : queries) {
        // parse the query
        String queryText = query.get("text");
        Node queryRoot = parseQuery(queryText, parameters);

        ScoredDocument[] results = retrieval.runQuery(queryRoot, requested);

        for (int i = 0; i < results.length; i++) {
            String document = retrieval.getDocumentName(results[i].document);
            double score = results[i].score;
            int rank = i + 1;

            System.out.format("%s Q0 %s %d %s galago\n", query.get("number"), document, rank,
                              formatScore(score));
        }
    }
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:30,代码来源:BatchSearch.java

示例4: run

import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
public static void run(String[] args, PrintStream out) throws Exception {
    // read in parameters
    Parameters parameters = new Parameters(args);
    List<Parameters.Value> queries = parameters.list("query");

    // open index
    Retrieval retrieval = Retrieval.instance(parameters.get("index"), parameters);

    // record results requested
    int requested = (int) parameters.get("count", 1000);

    // for each query, run it, get the results, look up the docnos, print in TREC format
    for (Parameters.Value query : queries) {
        // parse the query
        String queryText = query.get("text");
        Node queryRoot = parseQuery(queryText, parameters);
        queryRoot = retrieval.transformQuery(queryRoot);

        ScoredDocument[] results = retrieval.runQuery(queryRoot, requested);

        for (int i = 0; i < results.length; i++) {
            String document = retrieval.getDocumentName(results[i].document);
            double score = results[i].score;
            int rank = i + 1;

            out.format("%s Q0 %s %d %s galago\n", query.get("number"), document, rank,
                       formatScore(score));
        }
    }
}
 
开发者ID:UberRam,项目名称:GalagoGUI,代码行数:31,代码来源:BatchSearch.java

示例5: run

import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
public static void run(String[] args, final PrintStream out) throws Exception {
    // read in parameters
    final Parameters parameters = new Parameters(args);
    final List<Parameters.Value> queries = parameters.list("query");
    final int requested = (int) parameters.get("count", 1000);

    AsyncTaskService.get().init();
    // TermAssociationManager를 먼저 init 해둬야 함. 그래야 Thread-safe.
    TermAssociationManager.get().init();

    final int[] asyncIndex = {0};
    for (final Parameters.Value query : queries) {
        AsyncTaskService.get().runTask(AsyncTaskService.HIGH_PERFORMANCE, new Runnable() {
            @Override
            public void run() {
                try {
                    // open index
                    final Retrieval retrieval = Retrieval.instance(parameters.get("index"), parameters);

                    String queryText = query.get("text");
                    // IntApp modified.
                    String modquery = QueryModifier.modifyQuery(queryText);
                    Node queryRoot = parseQuery(modquery, parameters);
                    queryRoot = retrieval.transformQuery(queryRoot);

                    ScoredDocument[] results = retrieval.runQuery(queryRoot, requested);

                    for (int i = 0; i < results.length; i++) {
                        String document = retrieval.getDocumentName(results[i].document);
                        double score = results[i].score;
                        int rank = i + 1;
                        System.out.print(String.format("%s Q0 %s %d %s galago\n", query.get("number"), document, rank,
                                formatScore(score)));
                    }
                    asyncIndex[0]++;

                    if (asyncIndex[0] == queries.size())
                        System.exit(0);

                } catch (Exception ex) {
                    Thread t = Thread.currentThread();
                    t.getUncaughtExceptionHandler().uncaughtException(t, ex);
                }
            }
        });
    }
}
 
开发者ID:youngilcho,项目名称:internet-application-2014,代码行数:48,代码来源:BatchSearch.java


注:本文中的org.galagosearch.core.retrieval.Retrieval类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。