All Downloads are FREE. Search and download functionalities are using the official Maven repository.

crfsuite-0.12.native_loader.CrfSuiteNativeLoader Maven / Gradle / Ivy

Go to download

Jcrfsuite is a Java interface for crfsuite, a fast implementation of Conditional Random Fields, using SWIG and class injection technique

There is a newer version: 0.6.1
Show newest version
package native_loader;

import java.util.HashSet;
import java.util.Set;

/**
 * Adapted from SnappyNativeLoader.java (Snappy Java 1.0.4.1)
 */
public class CrfSuiteNativeLoader {

	private static Set loadedLibFiles = new HashSet();
	private static Set loadedLibNames = new HashSet();
	
	public static synchronized void loadLibByFile(String libFile) {
		if (!loadedLibFiles.contains(libFile)) {
			try {
				System.load(libFile);
				loadedLibFiles.add(libFile);
			} catch(Exception e) {
				e.printStackTrace();
			}
		}
	}
	
	public static synchronized void loadLibrary(String libName) {
		if (!loadedLibNames.contains(libName)) {
			try {
				System.loadLibrary(libName);
				loadedLibNames.add(libName);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy