sudeep87 / uimafit

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

support for Locale configuration parameters #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I would like to be able to annotate a member variable of type Locale with  
@ConfigurationParameter.  I was thinking that the value passed into a uima 
context would be a string array of length 1, 2, or 3 corresponding to the three 
constructors of locale.  However, if the length is 1, then it should check to 
see if it corresponds to the name of one of the convenience constants (e.g. 
"US", "CHINA", etc.) and if so return the corresponding Locale.  

Original issue reported on code.google.com by pvogren@gmail.com on 23 Dec 2010 at 6:58

GoogleCodeExporter commented 8 years ago
I think it would be good to allow a single string parameter that encodes the 
three parameters in that, e.g. pt-pt. Compare 
http://uima.apache.org/d/uimaj-2.3.1/api/org/apache/uima/resource/FileLanguageRe
sourceSpecifier.html

Original comment by whodance...@gmail.com on 23 Dec 2010 at 7:21

GoogleCodeExporter commented 8 years ago
Good idea.  It is hard to determine what the rule actually is based on the 
underlying impl code.  Does it suffice to look for a hyphen in the string and 
if there split on hyphens and call the appropriate constructor based on the 
number of values? 

Original comment by pvogren@gmail.com on 23 Dec 2010 at 8:01

GoogleCodeExporter commented 8 years ago
It is not possible to have a configuration parameter that takes either a single 
string or an array of strings (see 
org.uimafit.factory.ConfigurationParameterFactory.isMultiValued(Field)).  So, a 
locale value is specified only with a single string - either the name of a 
constant (e.g. "US") or a hyphen delimited set of values (e.g. "en-US").  If an 
empty string is passed in, then the default locale is used.  

Original comment by pvogren@gmail.com on 23 Dec 2010 at 10:23

GoogleCodeExporter commented 8 years ago
Nice. In this way the util class can also be used to parse the 
cas.getDocumentLanguage() into a Locale.

Original comment by whodance...@gmail.com on 26 Dec 2010 at 9:57