public void loadSegmenter(String filename, Properties p) { try { classifier = CRFClassifier.getClassifier(filename, p); } catch (ClassCastException | IOException | ClassNotFoundException e) { throw new RuntimeIOException("Failed to load segmenter " + filename, e); } }
segmenter = CRFClassifier.getClassifier(model, modelProps); } catch (RuntimeException e) { throw e;
public static <INN extends CoreMap & HasWord> AbstractSequenceClassifier<INN> loadClassifierFromPath(Properties props, String path) throws IOException { //try loading as a CRFClassifier try { return ErasureUtils.uncheckedCast(CRFClassifier.getClassifier(path, props)); } catch (Exception e) { e.printStackTrace(); } //try loading as a CMMClassifier try { return ErasureUtils.uncheckedCast(CMMClassifier.getClassifier(path)); } catch (Exception e) { //fail //log.info("Couldn't load classifier from path :"+path); throw new IOException("Couldn't load classifier from " + path, e); } }
is = new BufferedInputStream(is); model = CRFClassifier.getClassifier(is); } catch (IOException e) { throw new ServletException("IO problem reading classifier.");
extractor.classifier = CRFClassifier.getClassifier(path);
public void loadClassifier(File file, boolean crf) { try { if (crf) { classifier = CRFClassifier.getClassifier(file); } else { classifier = CMMClassifier.getClassifier(file); } } catch (Exception e) { String message = "Error loading "+(crf ? "CRF" : "CMM")+": "+file.getAbsolutePath(); String title = (crf ? "CRF" : "CMM")+" Load Error"; message += "\nMessage: "+e.getMessage(); displayError(title, message); return; } removeTags(); buildTagPanel(); buildExtractButton(); }
try { if (file != null) { classifier = CRFClassifier.getClassifier(file); } else {
try { if (resource != null) { classifier = CRFClassifier.getClassifier(resource); } else {
AbstractSequenceClassifier asc; if ( ! StringUtils.isNullOrEmpty(loadFile)) { asc = CRFClassifier.getClassifier(loadFile, props); } else if ( ! StringUtils.isNullOrEmpty(loadJarFile)) { asc = CRFClassifier.getClassifier(loadJarFile, props); } else { asc = CRFClassifier.getDefaultClassifier(props);
try { log.info("loading CRF..."); CRFClassifier<IN> newCRF = ErasureUtils.uncheckedCast(CRFClassifier.getClassifier(ois, props)); baseClassifiers.add(newCRF); i++;
AbstractSequenceClassifier<CoreLabel> classifier = CRFClassifier.getClassifier(serializedClassifier);
public void loadSegmenter(String filename, Properties p) { try { classifier = CRFClassifier.getClassifier(filename, p); } catch (ClassCastException | IOException | ClassNotFoundException e) { throw new RuntimeIOException("Failed to load segmenter " + filename, e); } }
private void loadModel(String segLoc, Properties props) { if (VERBOSE) { timer.start(); System.err.print("Loading Segmentation Model ["+segLoc+"]..."); } try { segmenter = CRFClassifier.getClassifier(segLoc, props); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } if (VERBOSE) { timer.stop("done."); } }
public void init() throws NamedEntityRecognizerException { if (initialized) throw new NamedEntityRecognizerException( "init() was called though the StanfordNamedEntityRecognizer was already initialized."); try { this.crfClassifier = CRFClassifier.getClassifier(this.classifierPath.getPath()); this.initialized = true; } catch (Exception e) { throw new NamedEntityRecognizerException("Classifier load failed.",e); } }
/** * @param segProps */ private void init(String model, Properties segProps) { if (VERBOSE) { timer.start(); System.err.print("Loading Segmentation Model [" + model + "]..."); } try { classifier = (CRFClassifier<CoreLabel>) CRFClassifier.getClassifier(model, segProps); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } if (VERBOSE) { timer.stop("done."); } }
public static <INN extends CoreMap & HasWord> AbstractSequenceClassifier<INN> loadClassifierFromPath(Properties props, String path) throws IOException { //try loading as a CRFClassifier try { return ErasureUtils.uncheckedCast(CRFClassifier.getClassifier(path, props)); } catch (Exception e) { e.printStackTrace(); } //try loading as a CMMClassifier try { return ErasureUtils.uncheckedCast(CMMClassifier.getClassifier(path)); } catch (Exception e) { //fail //log.info("Couldn't load classifier from path :"+path); throw new IOException("Couldn't load classifier from " + path, e); } }
extractor.classifier = CRFClassifier.getClassifier(path);
extractor.classifier = CRFClassifier.getClassifier(path);
public static <INN extends CoreMap & HasWord> AbstractSequenceClassifier<INN> loadClassifierFromPath(String path) throws FileNotFoundException { //try loading as a CRFClassifier try { return ErasureUtils.uncheckedCast(CRFClassifier.getClassifier(path)); } catch (Exception e) { e.printStackTrace(); } //try loading as a CMMClassifier try { return ErasureUtils.uncheckedCast(CMMClassifier.getClassifier(path)); } catch (Exception e) { //fail //System.err.println("Couldn't load classifier from path :"+path); FileNotFoundException fnfe = new FileNotFoundException(); fnfe.initCause(e); throw fnfe; } }
public static <INN extends CoreMap & HasWord> AbstractSequenceClassifier<INN> loadClassifierFromPath(String path) throws FileNotFoundException { //try loading as a CRFClassifier try { return ErasureUtils.uncheckedCast(CRFClassifier.getClassifier(path)); } catch (Exception e) { e.printStackTrace(); } //try loading as a CMMClassifier try { return ErasureUtils.uncheckedCast(CMMClassifier.getClassifier(path)); } catch (Exception e) { //fail //System.err.println("Couldn't load classifier from path :"+path); FileNotFoundException fnfe = new FileNotFoundException(); fnfe.initCause(e); throw fnfe; } }