alexyuen / duke

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

Parameters for cleaners (Enhancement) #64

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Would it be possible/interesting to specify parameters to the cleaners in the 
XML config file? 

My concrete example is a cleaner of dates. I want to standardize dates with a 
cleaner, but since the cleaner is only looking at one record at a time there's 
no way to automatically detect the date format, thus one needs a parameter to 
specify the element order.

The only way to do this now, if I understand well, would be to implement one 
cleaner for YMD, one for MDY and another one for DMY. (Or do a pre-cleaning 
elsewhere.)

Thanks.

Morten

Original issue reported on code.google.com by mortenj...@gmail.com on 5 Jan 2012 at 10:25

GoogleCodeExporter commented 8 years ago
What's missing here is mostly documentation. At the top, before <schema>, you 
can declare configurated objects, like so:

  <object class="no.priv.garshol.duke.comparators.NumericComparator"
          name="AreaComparator">
    <param name="min-ratio" value="0.7"/>
  </object>

You can then refer to the name of the object instead of the name of the class 
in the cleaner attribute.

The currently supported parameter types are: integer, boolean, double and 
string. If you need more, let me know.

I'm leaving this issue open to remind myself to document this properly.

Original comment by lar...@gmail.com on 5 Jan 2012 at 10:52

GoogleCodeExporter commented 8 years ago
Thanks, this works. Excellent. No need for anything else than the supported 
parameter types.

Original comment by mortenj...@gmail.com on 5 Jan 2012 at 1:19

GoogleCodeExporter commented 8 years ago
This has now been documented properly in the wiki.

Original comment by lar...@gmail.com on 7 Jan 2012 at 4:15