google-code-export / uimafit

Automatically exported from code.google.com/p/uimafit
2 stars 1 forks source link

Allow binding external resources in the same way as setting parameters #100

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice to be able to bind external resources to AEs in the same way 
as we set parameters. Here an example_

createPrimitiveDescription(MyDictionaryAnnotator.class, 
    PARAM_VERBOSE, true, 
    RES_DICTIONARY, createExternalResourceDescription(Dictionary.class, PARAM_FILE, "dict.txt")); 

Original issue reported on code.google.com by richard.eckart on 26 Sep 2011 at 7:31

GoogleCodeExporter commented 9 years ago
Done.

It's now stored in my student repository.

See 
yang/ExternalResource/uimafit/src/test/java/org/uimafit/factory/AnalysisEngineFa
ctoryExternalResourceTest.java

Original comment by s.y...@ishuo.de on 3 Jan 2012 at 2:06

GoogleCodeExporter commented 9 years ago

Original comment by richard.eckart on 4 Jan 2012 at 10:51

GoogleCodeExporter commented 9 years ago
- Added createExternalResourceDescription() calls that do not require to set a 
resource name for binding resources like we set parameters.
- Added test cases
- Extracted configuration parameter args list check into 
ConfigurationParameterFactory.ensureParametersComeInPairs()
- Allow adding external resources to AEs like we set parameters as part of the 
varargs list
- Thanks to Shuo Yang for preparing proof-of-concept implementation.
---
Committed revision 667.

Original comment by richard.eckart on 5 Jan 2012 at 12:35

GoogleCodeExporter commented 9 years ago
I did not transfer the changes to the 
ConfigurationParameterFactory.javaUimaTypeMap as they looked incomplete to me. 
I suppose this was the first try and then you gave up on this approach. I also 
did the integration without adding a dependency on Commons Lang 3 - simply 
nulling out the external resource parameters in the parameter list als does the 
job since parameters with null values are ignored by 
ConfigurationParameterFactory.createConfigurationData().

Furthermore, I just notice 
AnalysisEngineFactory.createPrimitive(AnalysisEngineDescription, Object...), 
AnalysisEngineFactory.setConfigurationParameters(AnalysisEngineDescription, 
Object...) and also the calls in CollectionReaderFactory and 
FlowControllerFactory do not understand the external resources yet, so I'll 
leave the issue in "Started" for the moment.

Original comment by richard.eckart on 5 Jan 2012 at 12:44

GoogleCodeExporter commented 9 years ago
Well, I'm not sure about the 
AnalysisEngineFactory.setConfigurationParameters(AnalysisEngineDescription, 
Object...) since it explicitly says "set parameters" here. Maybe defer that 
until we figure that it's really a good idea.

Original comment by richard.eckart on 9 Jan 2012 at 9:27

GoogleCodeExporter commented 9 years ago
I have been looking further into the issue now and think that 
AnalysisEngineFactory.setConfigurationParameters() and 
CollectionReaderFactory.setConfigurationParameters() should not be updated to 
support external resources. Actually I think the two methods should not be used 
at all. They are just convenience proxies for 
ResourceCreationSpecifierFactory.setConfigurationParameters().

Original comment by richard.eckart on 15 Jan 2012 at 4:18

GoogleCodeExporter commented 9 years ago
- Added support for external resources to flow controllers
- Added external resource injection tests for collection readers and flow 
controllers
- ConfigurationParameterFactory.createConfigurationData() ignores 
ExternalResourceDescriptions. This simplifies the code because we do no longer 
have to null parameter values.
- Some additional cleaning up
---
Fixed in revision 731.

Original comment by richard.eckart on 15 Jan 2012 at 5:22