Whatever message this page gives is out now! Go check it out!
docService.transform(documents, transformer)Parameter | Type | Required | Description |
|---|---|---|---|
documents | Array | Required | Array of document Structs as returned by load(). |
transformer | UDF / Closure | Required | Function with signature function(required Struct document) that returns a modified document Struct. The function may also return an Array to expand one document into multiple documents. |
cleaned = docService.transform(documents, function(required document) {
// Strip extra whitespace and add processing timestamp
document.text = reReplace(document.text, "\s+", " ", "ALL");
document.metadata.processedAt = now();
return document;
});