Package com.chenlb.mmseg4j.solr

Source Code of com.chenlb.mmseg4j.solr.Utils

package com.chenlb.mmseg4j.solr;

import java.io.File;

import org.apache.lucene.analysis.util.ResourceLoader;
import org.apache.solr.core.SolrResourceLoader;

import com.chenlb.mmseg4j.Dictionary;

public class Utils {

  public static Dictionary getDict(String dicPath, ResourceLoader loader) {
    Dictionary dic = null;
    if(dicPath != null) {
      File f = new File(dicPath);
      if(!f.isAbsolute() && loader instanceof SolrResourceLoader) {  //相对目录
        SolrResourceLoader srl = (SolrResourceLoader) loader;
        dicPath = srl.getInstanceDir()+dicPath;
        f = new File(dicPath);
      }

      dic = Dictionary.getInstance(f);
    } else {
      dic = Dictionary.getInstance();
    }
    return dic;
  }
}
TOP

Related Classes of com.chenlb.mmseg4j.solr.Utils

TOP
Copyright © 2018 www.massapi.com. 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.