
crfsuite-0.12.native_loader.CrfSuiteNativeLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcrfsuite Show documentation
Show all versions of jcrfsuite Show documentation
Jcrfsuite is a Java interface for crfsuite, a fast implementation of Conditional Random Fields,
using SWIG and class injection technique
The 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