Package org.fnlp.app.lucene

Examples of org.fnlp.app.lucene.FNLPAnalyzer


    System.out.println("Index directory '" + indexPath);
    Date start = new Date();
    Directory dir = FSDirectory.open(new File(indexPath));
    //需要先初始化 CNFactory
    CNFactory factory = CNFactory.getInstance("../models",Models.SEG_TAG);
    Analyzer analyzer = new FNLPAnalyzer(Version.LUCENE_47);
    // Now search the index:
    DirectoryReader ireader = DirectoryReader.open(dir);
    IndexSearcher isearcher = new IndexSearcher(ireader);
    // Parse a simple query that searches for "text":
    QueryParser parser = new QueryParser(Version.LUCENE_47, "content", analyzer);
View Full Code Here


    System.out.println("Indexing to directory '" + indexPath  + "'...");
    Date start = new Date();
    Directory dir = FSDirectory.open(new File(indexPath));//Dirctory dir-->FSDirectory
    //需要先初始化 CNFactory
    CNFactory factory = CNFactory.getInstance("../models",Models.SEG_TAG);
    Analyzer analyzer = new FNLPAnalyzer(Version.LUCENE_47);
    IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_47, analyzer);
    iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
    IndexWriter writer = new IndexWriter(dir, iwc);

    String[] strs = new String[]{
View Full Code Here

TOP

Related Classes of org.fnlp.app.lucene.FNLPAnalyzer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.