Hi Franco,
2010/11/8 Franco Fallica <[email protected]>
> I've been working on something quite similar. And while looking at your
> code I decided to abandon my stuff and rather use yours as a basis for what
> we are trying to accomplish.
what is that exactly, can I help in some ways?
> Would it be possible for you to write a (very) short how-to about how to
> use your implementation or could you provide a short example?
>
You can find very short examples inside ExternalServicesFacadeTest inside
org.apache.clerezza.uima.utils module.
A common scenario can go like this:
// node representing a text resource
Node existingNode = ....
// create the UIMAServicesFacade
UIMAServicesFacade uimaServicesFacade = new ExternalServicesFacade();
// set runtime parameters for AlchemyAPI/OpenCalais inside a Map
Map<String, Object> parameterSettings = new HashMap<String, Object>();
parameterSettings.put("apikey", "AVALIDALCHEMYAPIKEY"); // param for
> AlchemyAPI
externalServicesFacade.setParameterSetting(parameterSettings);
> // extract a list of concepts related to a text
String resourceText = existingNode.toString();
List<FeatureStructure> concepts =
> externalServicesFacade.getConcepts(resourceText);
then with that list of FeatureStructures, that are UIMA objects containing
Types (entities or annotations) and their Features (properties) you can
enhance the node representing that resource.
UIMAUtils.enhanceNode(existingNode, concepts);
the enhanceNode() method uses the ontology inside
org.apache.clerezza.uima.ontologies module to build a graph of UIMA types
and features binding it to the existingNode.
You can find such a behavior inside the metadata-generator.
I hope I clarified a little bit, If not (sorry and) let me know or keep
asking.
Regards,
Tommaso