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


Java CRFClassifier.getClassifierNoExceptions方法代码示例

本文整理汇总了Java中edu.stanford.nlp.ie.crf.CRFClassifier.getClassifierNoExceptions方法的典型用法代码示例。如果您正苦于以下问题:Java CRFClassifier.getClassifierNoExceptions方法的具体用法?Java CRFClassifier.getClassifierNoExceptions怎么用?Java CRFClassifier.getClassifierNoExceptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.stanford.nlp.ie.crf.CRFClassifier的用法示例。


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

示例1: preprocess

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
public Concept preprocess(Concept c) {

		if (this.tagger == null)
			this.tagger = new MaxentTagger("ext_models/pos_tagger/english-left3words-distsim.tagger");
		if (this.ner == null)
			this.ner = CRFClassifier.getClassifierNoExceptions("ext_models/ner/english.all.3class.distsim.crf.ser.gz");

		List<CoreLabel> words = tokFactory.getTokenizer(new StringReader(c.name)).tokenize();
		tagger.tagCoreLabels(words);
		words = ner.classifySentence(words);
		words = this.addLemmas(words);

		List<PToken> tokens = new ArrayList<PToken>();
		for (CoreLabel word : words) {
			PToken t = new PToken(word.originalText());
			t.pos = word.tag();
			t.neTag = word.get(CoreAnnotations.AnswerAnnotation.class);
			t.lemma = word.get(LemmaAnnotation.class);
			tokens.add(t);
		}
		c.tokenList = tokens;

		return c;
	}
 
开发者ID:UKPLab,项目名称:ijcnlp2017-cmaps,代码行数:25,代码来源:NonUIMAPreprocessor.java

示例2: CRF

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
public static void CRF() {
	// Classifer
       CRFClassifier<CoreMap> crf
               = CRFClassifier.getClassifierNoExceptions(
                       "C:/Current Books in Progress/NLP and Java/Models"
                       + "/english.all.3class.distsim.crf.ser.gz");
       String S1 = "Good afternoon Rajat Raina, how are you today?";
       String S2 = "I go to school at Stanford University, which is located in California.";
       System.out.println(crf.classifyToString(S1));
       System.out.println(crf.classifyWithInlineXML(S2));
       System.out.println(crf.classifyToString(S2, "xml", true));

       Object classification[] = crf.classify(S2).toArray();
       for (int i = 0; i < classification.length; i++) {
           System.out.println(classification[i]);
       }
}
 
开发者ID:jackeylu,项目名称:NLP_with_Java_zh,代码行数:18,代码来源:UseStanfordClassifier.java

示例3: NERHelper

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
public NERHelper() {
	super();
	try {
		this.classifier = CRFClassifier
				.getClassifierNoExceptions(Constants.serializedClassifier);
		dbBuilderFactory = DocumentBuilderFactory.newInstance();
		dBuilder = dbBuilderFactory.newDocumentBuilder();
	} catch (ParserConfigurationException e) {
		e.printStackTrace();
	}
	
}
 
开发者ID:T-abide,项目名称:SocialEventExtraction,代码行数:13,代码来源:NERHelper.java

示例4: init

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
@Override
public void init() throws ServletException
{
    String modelPath = getServletContext().getRealPath("models/slovenian.ser.gz");
    classifier = CRFClassifier.getClassifierNoExceptions(modelPath);
    mapper = new ObjectMapper();
}
 
开发者ID:izacus,项目名称:slo_ner_service,代码行数:8,代码来源:NERTagger.java

示例5: getClassifier

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
/**
 * @return a singleton classifier
 */
public static final CRFClassifier<CoreLabel> getClassifier() {
	if (classifier == null) {
		classifier = CRFClassifier
				.getClassifierNoExceptions(serializedClassifier);
	}
	return classifier;
}
 
开发者ID:mimitantono,项目名称:FindName,代码行数:11,代码来源:ClassifierFactory.java

示例6: loadModel

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
private void loadModel(String segLoc) {
  if (VERBOSE) {    
    timer.start();
    System.err.print("Loading Segmentation Model ["+segLoc+"]...");
  }
  segmenter = CRFClassifier.getClassifierNoExceptions(segLoc);
  if (VERBOSE) {    
    timer.stop("done.");
  }
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:11,代码来源:ChineseSegmenterAnnotator.java

示例7: initNER

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
public void initNER() {
    String serializedClassifier = "data/chinese.misc.distsim.crf.ser.gz";
    if (ner == null) {
        ner = CRFClassifier.getClassifierNoExceptions(serializedClassifier);
    }
}
 
开发者ID:IACASNLPIR,项目名称:GKHMC,代码行数:7,代码来源:NER.java

示例8: getClassifier

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
private static AbstractSequenceClassifier<CoreLabel> getClassifier() {
	String serializedClassifier = "Files/english.all.3class.distsim.crf.ser.gz";
	AbstractSequenceClassifier<CoreLabel> classifier = CRFClassifier
			.getClassifierNoExceptions(serializedClassifier);
	return classifier;
}
 
开发者ID:rkhatib,项目名称:topotext,代码行数:7,代码来源:ReadNovelImp.java

示例9: EntitiesExtractor

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
public EntitiesExtractor(String serializedClassifier) {
	classifier = CRFClassifier.getClassifierNoExceptions(serializedClassifier);
}
 
开发者ID:MKLab-ITI,项目名称:mgraph-summarization,代码行数:4,代码来源:EntitiesExtractor.java

示例10: EnglishStanfordNERParser

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
/**
 * Default protected constructor
 * 
 */
public EnglishStanfordNERParser() {
  String classifierPath = "res/en/english.all.3class.distsim.crf.ser.gz";
  classifier = CRFClassifier.getClassifierNoExceptions(classifierPath);

}
 
开发者ID:weizh,项目名称:geolocator-3.0,代码行数:10,代码来源:EnglishStanfordNERParser.java

示例11: StanfordNER

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
/**
 * Constructor which handles an commited Classifier Filename 
 * @param clfFilename
 */
public StanfordNER(String clfFilename)
{
	serializedClassifier = clfFilename;
	classifier = CRFClassifier.getClassifierNoExceptions(serializedClassifier);
}
 
开发者ID:drossner,项目名称:WikiN-G-ER,代码行数:10,代码来源:StanfordNER.java

示例12: Index

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
public Index(String classifierFile) {
	this.classifier = CRFClassifier.getClassifierNoExceptions(classifierFile);
}
 
开发者ID:flaxsearch,项目名称:hackday,代码行数:4,代码来源:Index.java

示例13: getClassifier

import edu.stanford.nlp.ie.crf.CRFClassifier; //导入方法依赖的package包/类
/**
 * Gets the classifier to use for parsing text
 *
 * @param config
 *            The configuration object containing information about which classifier to use.
 * @return The classifier to use for extracting entities.
 */
private AbstractSequenceClassifier<CoreLabel> getClassifier(String classifierStr) {
    URL classifierURL = Resources.getResource(classifierStr);
    AbstractSequenceClassifier<CoreLabel> classifier =
        CRFClassifier.getClassifierNoExceptions(classifierURL.getPath());
    return classifier;
}
 
开发者ID:OpenChatAlytics,项目名称:OpenChatAlytics,代码行数:14,代码来源:EntityExtractionBolt.java


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