本文整理汇总了Java中gate.util.persistence.PersistenceManager.loadObjectFromFile方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceManager.loadObjectFromFile方法的具体用法?Java PersistenceManager.loadObjectFromFile怎么用?Java PersistenceManager.loadObjectFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gate.util.persistence.PersistenceManager
的用法示例。
在下文中一共展示了PersistenceManager.loadObjectFromFile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GateRESCALProcessing
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
public GateRESCALProcessing(String gateAppPath, String baseFolder,
boolean createContentSlice, boolean useStemming) throws GateException, IOException {
matchingData = new WonMatchingData();
this.baseFolder = baseFolder;
this.createContentSlice = createContentSlice;
this.useStemming = useStemming;
// init Gate
logger.info("Initialising Gate");
Gate.init();
// load Gate application
logger.info("Loading Gate application: {}", gateAppPath);
gateApplication = (CorpusController)
PersistenceManager.loadObjectFromFile(new File(gateAppPath));
}
示例2: initializeAnnie
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
public void initializeAnnie() throws GateException, MalformedURLException, IOException {
Gate.setGateHome(new File(GATE_HOME));
Gate.setPluginsHome(new File(GATE_PLUGIN_HOME));
Gate.setSiteConfigFile(new File(CONFIG_FILE));
Gate.init();
log("GATE initialised");
// Load ANNIE plugin
File pluginsHome = Gate.getPluginsHome();
File anniePlugin = new File(pluginsHome, "ANNIE");
File annieGapp = new File(anniePlugin, "ANNIE_with_defaults.gapp");
annieController = (CorpusController) PersistenceManager.loadObjectFromFile(annieGapp);
log("ANNIE loaded successfully");
}
示例3: loadApp
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
@BeforeClass
public static void loadApp() throws MalformedURLException, IOException, GateException {
if (!Gate.isInitialised()) {
Gate.init();
}
Properties sysProps = System.getProperties();
String appName = sysProps.getProperty("munpex.en.app.name");
munpexApp = (CorpusController) PersistenceManager.loadObjectFromFile(
new File(appName));
}
示例4: main
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
/**
* This is testing code used during development.
* TODO: delete it!
*/
public static void main(String[] args){
try {
Gate.init();
MainFrame.getInstance().setVisible(true);
Gate.getCreoleRegister().registerDirectories(new File(".").toURI().toURL());
File session = Gate.getUserSessionFile();
if(session == null) session = new File(System.getProperty("user.home") +
".gate.session");
if(session.exists()) PersistenceManager.loadObjectFromFile(session);
} catch(Exception e) {
e.printStackTrace();
}
}
示例5: initPlugins
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
@Override
public void initPlugins() {
File annieGapp = new File(Gate.getGateHome(), "recruiterVision.gapp");
try {
corpusController = (CorpusController) PersistenceManager.loadObjectFromFile(annieGapp);
} catch (PersistenceException | IOException | ResourceInstantiationException e) {
e.printStackTrace();
}
logger.info("Annie and plugins inited");
}
示例6: initPersistentGateResources
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
/**
* Method which init application from GATE application stored on the local drive
*/
private void initPersistentGateResources() {
try {
Corpus corpus = Factory.newCorpus("New Corpus");
corpusController = (CorpusController) PersistenceManager.loadObjectFromFile(new File("application.xgapp"));
corpusController.setCorpus(corpus);
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例7: loadApp
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
@BeforeClass
public static void loadApp() throws MalformedURLException, IOException, GateException {
if (!Gate.isInitialised()) {
Gate.init();
}
Properties sysProps = System.getProperties();
String appName = sysProps.getProperty("reextraction.app.name");
rhetectorApp = (CorpusController) PersistenceManager.loadObjectFromFile(
new File(appName));
}
示例8: initAnnie
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
/**
* Initialise the ANNIE system. This creates a "corpus pipeline"
* application that can be used to run sets of documents through
* the extraction system.
*/
public void initAnnie() throws GateException, IOException {
Out.prln("Initialising ANNIE...");
// load the ANNIE application from the saved state in plugins/ANNIE
File pluginsHome = Gate.getPluginsHome();
File anniePlugin = new File(pluginsHome, "ANNIE");
File annieGapp = new File(anniePlugin, "ANNIE_with_defaults.gapp");
annieController =
(CorpusController) PersistenceManager.loadObjectFromFile(annieGapp);
Out.prln("...ANNIE loaded");
}
示例9: initializeAnnie
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
public CorpusController initializeAnnie() throws GateException, IOException {
File pluginsHome = Gate.getPluginsHome();
File annieGapp = new File(pluginsHome + "/ANNIE", "ANNIE_with_defaults.gapp");
return (CorpusController) PersistenceManager.loadObjectFromFile(annieGapp);
}
示例10: checkPersistence
import gate.util.persistence.PersistenceManager; //导入方法依赖的package包/类
public void checkPersistence(File xgappFile, ResourceReference rr1, String expected) throws Exception {
Resource resource = null, restored = null;
try {
FeatureMap params = Factory.newFeatureMap();
params.put("param", rr1);
resource = Factory.createResource(TestResource.class.getName(),params);
PersistenceManager.saveObjectToFile(resource, xgappFile);
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(xgappFile);
Element entry = doc.getRootElement().getChild("application").getChild("initParams").getChild("localMap").getChild("entry");
assertEquals("couldn't find the paramameter entry", "param",entry.getChildText("string"));
Element value = entry.getChild("gate.util.persistence.PersistenceManager-RRPersistence");
assertNotNull("We couldn't find the RRPersistence wrapper",value);
assertEquals("The URI was not as expected",expected, value.getChildText("uriString"));
restored = (Resource)PersistenceManager.loadObjectFromFile(xgappFile);
ResourceReference rr2 = (ResourceReference)restored.getParameterValue("param");
assertEquals(rr1, rr2);
} finally {
if (xgappFile != null) xgappFile.deleteOnExit();
if(resource != null) {
Factory.deleteResource(resource);
}
if(restored != null) {
Factory.deleteResource(restored);
}
}
}