当前位置: 首页>>代码示例>>Java>>正文


Java ResourceSpecifier类代码示例

本文整理汇总了Java中org.apache.uima.resource.ResourceSpecifier的典型用法代码示例。如果您正苦于以下问题:Java ResourceSpecifier类的具体用法?Java ResourceSpecifier怎么用?Java ResourceSpecifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceSpecifier类属于org.apache.uima.resource包,在下文中一共展示了ResourceSpecifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  super.initialize(aSpecifier, aAdditionalParams);
  hits = Integer.class.cast(getParameterValue("hits"));
  // query constructor
  String stoplistPath = String.class.cast(getParameterValue("stoplist-path"));
  try {
    stoplist = Resources.readLines(getClass().getResource(stoplistPath), UTF_8).stream()
            .map(String::trim).collect(toSet());
  } catch (IOException e) {
    throw new ResourceInitializationException(e);
  }
  analyzer = new StandardAnalyzer();
  parser = new QueryParser("text", analyzer);
  return true;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:18,代码来源:LuceneInMemoryPassageScorer.java

示例2: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  super.initialize(aSpecifier, aAdditionalParams);
  String positiveWordlistPath = (String) getParameterValue("positive-wordlist-path");
  String negativeWordlistPath = (String) getParameterValue("negative-wordlist-path");
  try {
    positiveWords = Resources
            .readLines(getClass().getResource(positiveWordlistPath), Charsets.UTF_8).stream()
            .collect(toSet());
    negativeWords = Resources
            .readLines(getClass().getResource(negativeWordlistPath), Charsets.UTF_8).stream()
            .collect(toSet());
  } catch (IOException e) {
    throw new ResourceInitializationException(e);
  }
  viewNamePrefix = String.class.cast(getParameterValue("view-name-prefix"));
  return true;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:20,代码来源:SentimentYesNoScorer.java

示例3: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  String stoplistFile = (String) getParameterValue("stoplist");
  try {
    stoplist = Resources.readLines(getClass().getResource(stoplistFile), Charsets.UTF_8).stream()
            .collect(toSet());
  } catch (IOException e) {
    throw new ResourceInitializationException(e);
  }
  windowSize = (int) getParameterValue("window-size");
  infinity = (double) getParameterValue("infinity");
  smoothing = (double) getParameterValue("smoothing");
  return ret;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:17,代码来源:ParseHeadProximityAnswerScorer.java

示例4: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  String stoplistFile = (String) getParameterValue("stoplist");
  try {
    stoplist = Resources.readLines(getClass().getResource(stoplistFile), Charsets.UTF_8).stream()
            .collect(toSet());
    checkStoplist = true;
  } catch (Exception e) {
    checkStoplist = false;
  }
  filterQuestionTokens = (Boolean) getParameterValue("filter-question-tokens");
  filterQuestionConcepts = (Boolean) getParameterValue("filter-question-concepts");
  return ret;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:17,代码来源:ConceptCavGenerator.java

示例5: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  // initialize delegate
  CustomResourceSpecifier delegateResourceSpecifier = new CustomResourceSpecifier_impl();
  delegateResourceSpecifier.setResourceClassName(delegateClass.getCanonicalName());
  delegate = delegateClass.cast(UIMAFramework.produceResource(delegateClass,
          delegateResourceSpecifier, aAdditionalParams));
  // initialize mapdb
  File file = new File((String) getParameterValue("db-file"));
  db = DBMaker.newFileDB(file).compressionEnable().commitFileSyncDisable().cacheSize(128)
          .closeOnJvmShutdown().make();
  String map = (String) getParameterValue("map-name");
  id2synonyms = db.getHashMap(map);
  return ret;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:18,代码来源:CachedUtsSynonymExpansionProvider.java

示例6: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  String version = String.class.cast(getParameterValue("version"));
  String username = String.class.cast(getParameterValue("username"));
  String password = String.class.cast(getParameterValue("password"));
  String email = String.class.cast(getParameterValue("email"));
  conf = createConf(version, username, password, email, false, 0);
  xmlInputFactory = XMLInputFactory.newFactory();
  try {
    transformer = new TransformerFactoryImpl().newTransformer();
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
    transformer.setOutputProperty(OutputKeys.INDENT, "no");
    unmarshaller = JAXBContext.newInstance(MetaMapObject.class).createUnmarshaller();
  } catch (TransformerConfigurationException | JAXBException e) {
    throw new ResourceInitializationException();
  }
  return ret;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:21,代码来源:MetaMapConceptProvider.java

示例7: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  this.service = String.class.cast(getParameterValue("service"));
  this.version = String.class.cast(getParameterValue("version"));
  securityService = (new UtsWsSecurityControllerImplService())
          .getUtsWsSecurityControllerImplPort();
  String username = String.class.cast(getParameterValue("username"));
  String password = String.class.cast(getParameterValue("password"));
  try {
    grantTicket = securityService.getProxyGrantTicket(username, password);
  } catch (UtsFault_Exception e) {
    throw new ResourceInitializationException(e);
  }
  finderService = (new UtsWsFinderControllerImplService()).getUtsWsFinderControllerImplPort();
  contentService = (new UtsWsContentControllerImplService()).getUtsWsContentControllerImplPort();
  semanticNetworkService = (new UtsWsSemanticNetworkControllerImplService())
          .getUtsWsSemanticNetworkControllerImplPort();
  return ret;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:22,代码来源:UtsConceptSearchProvider.java

示例8: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  this.service = String.class.cast(getParameterValue("service"));
  this.version = String.class.cast(getParameterValue("version"));
  securityService = (new UtsWsSecurityControllerImplService())
          .getUtsWsSecurityControllerImplPort();
  String username = String.class.cast(getParameterValue("username"));
  String password = String.class.cast(getParameterValue("password"));
  try {
    grantTicket = securityService.getProxyGrantTicket(username, password);
  } catch (UtsFault_Exception e) {
    throw new ResourceInitializationException(e);
  }
  contentService = (new UtsWsContentControllerImplService()).getUtsWsContentControllerImplPort();
  nthreads = Integer.class.cast(getParameterValue("nthreads"));
  timeout = Integer.class.cast(getParameterValue("timeout"));
  return ret;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:21,代码来源:UtsSynonymExpansionProvider.java

示例9: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
  boolean ret = super.initialize(aSpecifier, aAdditionalParams);
  // initialize delegate
  CustomResourceSpecifier delegateResourceSpecifier = new CustomResourceSpecifier_impl();
  delegateResourceSpecifier.setResourceClassName(delegateClass.getCanonicalName());
  delegate = delegateClass.cast(UIMAFramework.produceResource(delegateClass,
          delegateResourceSpecifier, aAdditionalParams));
  // initialize mapdb
  File file = new File((String) getParameterValue("db-file"));
  db = DBMaker.newFileDB(file).compressionEnable().commitFileSyncDisable().cacheSize(128)
          .closeOnJvmShutdown().make();
  String map = (String) getParameterValue("map-name");
  string2concept = db.getHashMap(map);
  return ret;
}
 
开发者ID:oaqa,项目名称:bioasq,代码行数:18,代码来源:CachedUtsConceptSearchProvider.java

示例10: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
    throws ResourceInitializationException
{
    if (!super.initialize(aSpecifier, aAdditionalParams)) {
        return false;
    }

    try {
        loadDictionary();
    }
    catch (IOException e) {
        throw new ResourceInitializationException(e);
    }
    return true;
}
 
开发者ID:Horsmann,项目名称:FlexTag,代码行数:17,代码来源:PoSDictionaryTagFeature.java

示例11: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
    throws ResourceInitializationException
{
    if (!super.initialize(aSpecifier, aAdditionalParams)) {
        return false;
    }

    try {
        init();
    }
    catch (Exception e) {
        throw new ResourceInitializationException(e);
    }
    return true;
}
 
开发者ID:Horsmann,项目名称:FlexTag,代码行数:17,代码来源:BrownCluster.java

示例12: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
		throws ResourceInitializationException {
	if (!super.initialize(aSpecifier, aAdditionalParams)) {
		return false;
	}
	this.logger = this.getLogger();

	// init db
	try {
		if (createDb) {
			createDb(dbUrl, dbName, dbUser, dbPass);
			logger.log(Level.INFO, "DB " + dbName + " created");
		} else {
			initDb(dbUrl, dbName, dbUser, dbPass);
		}
	} catch (Exception e) {
		e.printStackTrace();
		System.exit(1);
	}
	
	prepareStatements();

	return true;
}
 
开发者ID:tudarmstadt-lt,项目名称:newsleak-frontend,代码行数:26,代码来源:PostgresResource.java

示例13: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
		throws ResourceInitializationException {
	if (!super.initialize(aSpecifier, aAdditionalParams)) {
		return false;
	}
	this.logger = this.getLogger();
	Settings settings = Settings.builder().put("cluster.name", mClustername).build();
	try {
		//			client = new PreBuiltTransportClient(settings)
		//			        .addTransportAddress(new TransportAddress(InetAddress.getLocalHost(), mPort));
		client = TransportClient.builder().settings(settings).build()
				.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(mHost), mPort));
		if (createIndex) {
			createIndex();
		}
	} catch (Exception e) {
		e.printStackTrace();
		System.exit(0);
	}
	return true;
}
 
开发者ID:tudarmstadt-lt,项目名称:newsleak-frontend,代码行数:23,代码来源:ElasticsearchResource.java

示例14: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
    if (!super.initialize(aSpecifier, aAdditionalParams)) return false;
    //
    BufferedInputStream in;
    try {
        in = new BufferedInputStream(resourceMeta.getInputStream());
    } catch (Exception e) {
        throw new ResourceInitializationException(e);
    }
    // closes stream
    resourceObject = SerializationUtils.deserialize(in);
    if (expectedClass != null && !expectedClass.isInstance(resourceObject)) {
        throw new IllegalStateException(format("Unexpected type of object in %s, expected - %s, actual - %s",
                resourceMeta, expectedClass.getName(), resourceObject.getClass().getName()));
    }
    return true;
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:20,代码来源:SerializedResourceLocator.java

示例15: initialize

import org.apache.uima.resource.ResourceSpecifier; //导入依赖的package包/类
@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams)
        throws ResourceInitializationException {
    if (!super.initialize(aSpecifier, aAdditionalParams)) return false;
    //
    resourceMeta = resourceLoader.getResource(resourceLocation);
    if (resourceMeta == null) {
        throw new IllegalStateException(format("Can't wrap path %s into Resource", resourceLocation));
    }
    if (!resourceMeta.exists()) {
        // try to resolve against UIMA datapath
        try {
            File resourceFile = resourceMeta.getFile();
            resourceFile = UimaResourceUtils.resolveFile(resourceFile.getPath(), getResourceManager());
            resourceMeta = new FileSystemResource(resourceFile);
        } catch (Exception e) {
            throw new ResourceInitializationException(e);
        }
    }
    return true;
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:22,代码来源:SpringResourceLocator.java


注:本文中的org.apache.uima.resource.ResourceSpecifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。