devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Devicemap Wiki] Update of "DataSpec2" by rezan
Date Wed, 14 Jan 2015 13:17:51 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Devicemap Wiki" for change notification.

The "DataSpec2" page has been changed by rezan:
https://wiki.apache.org/devicemap/DataSpec2?action=diff&rev1=30&rev2=31

  === Example ===
  
  {{{
- InputTransformers: lowercase, ReplaceAll(Find: '-', Replace: '')
+ InputTransformers: Lowercase(), ReplaceAll(find: '-', replaceWith: '')
  TokenSeparators:   [space]
  NgramConcatSize:   2
  
@@ -264, +264 @@

  
  === Notes ===
  
- If no attribute map is found, an empty map can be used.
+ If no attribute map is found, an empty map is used.
  
  If a null pattern is returned from the previous step, this must be safely returned.
  TODO: how?
@@ -274, +274 @@

  = Transformers =
  
  Transformers take in an input string, apply an action, and then return a string.
+ If multiple transformers are defined in a set, the outputs and inputs are
+ chained together.
+ Transformers are used in the input parsing phase and the attribute retrieval phase.
+ 
+ Transformers can cause errors. Errors in input parsing are fatal, input parsing
+ is immediately stopped and an error is returned to the user. Errors in attribute retrieval
+ are okay. The error is written to [attribute]_error and the attribute is set to the default
value,
+ if configured, or a blank value. [attribute]_error is a reserved attribute name.
+ 
+ The following transformer functions are supported:
+ 
+  Lowercase::
+  :: Description: converts the input to all lowercase
+  :: Return: the input in lowercase
+ 
+  Uppercase::
+  :: Description: converts the input to all uppercase
+  :: Return: the input in uppercase
+ 
+  Replace::
+  :: Description: replace the first occurrence of a string with another string
+  :: Parameter - find: the substring to replace
+  :: Parameter - replaceWith: the string to replace 'find' with
+  :: Return: the string with the replacement made
+ 
+  ReplaceAll::
+  :: Description: replace all occurrences of a string with another string
+  :: Parameter - find: the substring to replace
+  :: Parameter - replaceWith: the string to replace 'find' with
+  :: Return: the string with the replacements made
+ 
+  SplitAndGet::
+  :: Description: split the input and return a part of the split
+  :: Parameter - delimiter: the delimiter to use for splitting. If not found, the entire
string is part 0. Empty parts are ignored. -1 returns the last part.
+  :: Parameter - get: the part of the split string to return, 0 based index
+  :: Return: the specified part of the split string
+  :: Error: if the 'get' index does not exist
+ 
+  IsNumber::
+  :: Description: checks if the input is a number
+  :: Return: the input string
+  :: Error: if the input is not a number
+ 
+ 
+ === Examples ===
+ 
+ {{{
+ Input string: 'I am 47 years old.'
+ 
+ Transformers:
+ 
+ SplitAndGet(delimiter: 'years old', get: 0)
+ Result: 'I am 47 '
+ 
+ SplitAndGet(delimiter: ' ', get: -1)
+ Result: '47'
+ 
+ IsNumber()
+ Result: '47'
+ }}}
  
  
  

Mime
View raw message