public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(ObjectInputStream ois) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(ois,null); return crf; }
public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(ObjectInputStream ois, Properties props) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(ois, props); return crf; }
public static CRFClassifier<CoreLabel> getClassifier(String loadPath) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<CoreLabel> crf = new CRFClassifier<>(); crf.loadClassifier(loadPath); return crf; }
public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(String loadPath, Properties props) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(loadPath, props); return crf; }
@Override @SuppressWarnings( { "unchecked" }) // can't have right types in deserialization public void loadClassifier(ObjectInputStream ois, Properties props) throws ClassCastException, IOException, ClassNotFoundException { super.loadClassifier(ois, props); nodeFeatureIndicesMap = (Index<Integer>) ois.readObject(); edgeFeatureIndicesMap = (Index<Integer>) ois.readObject(); if (flags.secondOrderNonLinear) { inputLayerWeights4Edge = (double[][]) ois.readObject(); outputLayerWeights4Edge = (double[][]) ois.readObject(); } else { linearWeights = (double[][]) ois.readObject(); } inputLayerWeights = (double[][]) ois.readObject(); outputLayerWeights = (double[][]) ois.readObject(); }
/** * Loads a CRF classifier from a filepath, and returns it. * * @param file File to load classifier from * @return The CRF classifier * * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(File file) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(file); return crf; }
/** * Loads a CRF classifier from an InputStream, and returns it. This method * does not buffer the InputStream, so you should have buffered it before * calling this method. * * @param in InputStream to load classifier from * @return The CRF classifier * * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(InputStream in) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(in); return crf; }
public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(ObjectInputStream ois) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(ois,null); return crf; }
public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(ObjectInputStream ois, Properties props) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(ois, props); return crf; }
public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(String loadPath, Properties props) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(loadPath, props); return crf; }
public static CRFClassifier<CoreLabel> getClassifier(String loadPath) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<CoreLabel> crf = new CRFClassifier<CoreLabel>(); crf.loadClassifier(loadPath); return crf; }
public static CRFClassifier<CoreLabel> getClassifier(String loadPath) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<CoreLabel> crf = new CRFClassifier<>(); crf.loadClassifier(loadPath); return crf; }
public static CRFClassifier<? extends CoreMap> getClassifier(String loadPath, Properties props) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<? extends CoreMap> crf = new CRFClassifier<CoreMap>(); crf.loadClassifier(loadPath, props); return crf; }
public static CRFClassifier getClassifier(String loadPath) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier crf = new CRFClassifier(); crf.loadClassifier(loadPath); return crf; }
public static CRFClassifier getClassifier(String loadPath, Properties props) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier crf = new CRFClassifier(); crf.loadClassifier(loadPath, props); return crf; }
@Override @SuppressWarnings( { "unchecked" }) // can't have right types in deserialization public void loadClassifier(ObjectInputStream ois, Properties props) throws ClassCastException, IOException, ClassNotFoundException { super.loadClassifier(ois, props); nodeFeatureIndicesMap = (Index<Integer>) ois.readObject(); edgeFeatureIndicesMap = (Index<Integer>) ois.readObject(); if (flags.secondOrderNonLinear) { inputLayerWeights4Edge = (double[][]) ois.readObject(); outputLayerWeights4Edge = (double[][]) ois.readObject(); } else { linearWeights = (double[][]) ois.readObject(); } inputLayerWeights = (double[][]) ois.readObject(); outputLayerWeights = (double[][]) ois.readObject(); }
/** Loads a CRF classifier from a filepath, and returns it. * * @param file File to load classifier from * @return The CRF classifier * * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public static<IN extends CoreMap> CRFClassifier<IN> getClassifier(File file) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<IN> crf = new CRFClassifier<IN>(); crf.loadClassifier(file); return crf; }
/** Loads a CRF classifier from an InputStream, and returns it. This method * does not buffer the InputStream, so you should have buffered it before * calling this method. * * @param in InputStream to load classifier from * @return The CRF classifier * * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public static CRFClassifier getClassifier(InputStream in) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier crf = new CRFClassifier(); crf.loadClassifier(in); return crf; }
/** * Loads a CRF classifier from a filepath, and returns it. * * @param file File to load classifier from * @return The CRF classifier * * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public static <INN extends CoreMap> CRFClassifier<INN> getClassifier(File file) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<INN> crf = new CRFClassifier<>(); crf.loadClassifier(file); return crf; }
public void loadSegmenter(String filename, Properties p) { classifier = new CRFClassifier<CoreLabel>(p); try { classifier.loadClassifier(new File(filename), p); } catch (ClassCastException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } }