-
Created by user-b55ff, last modified by user-1b188 on Feb 25, 2019
You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 8
Next »
Operates On: Every lexical Item in the graph.
Generic Configuration Parameters
-
boundaryFlags ( type=string array
| optional
)
- List of vertex flags that indicate the beginning and end of a text block.
Tokens to process must be inside two vertices marked with this flag (e.g ["TEXT_BLOCK_SPLIT"]) -
skipFlags ( type=string array
| optional
)
- Flags to be skipped by this stage.
Tokens marked with this flag will be ignored by this stage, and no processing will be performed. -
requiredFlags ( type=string array
| optional
)
- Lex items flags required by every token to be processed.
Tokens need to have all of the specified flags in order to be processed. -
atLeastOneFlag ( type=string array
| optional
)
- Lex items flags needed by every token to be processed.
Tokens will need at least one of the flags specified in this array. -
confidenceAdjustment ( type=double
| default=1
| required
)
- Adjustment factor to apply to the confidence value of 0.0 to 2.0 from (Applies for every pattern match).
- 0.0 to < 1.0 decreases confidence value
- 1.0 confidence value remains the same
- > 1.0 to 2.0 increases confidence value
-
debug ( type=boolean
| default=false
| optional
)
- Enable all debug log functionality for the stage, if any.
-
enable ( type=boolean
| default=true
| optional
)
- Indicates if the current stage should be consider for the Pipeline Manager
- Only applies for automatic pipeline building
Generic Producer Configuration Parameters
-
name ( type=string
| required
)
- Unique name to identify the stage in the pipeline
- It is used programmatically to retrieve the stage and consume the produced output.
-
queueSize ( type=integer
| default=10000
| optional
)
- Max number of produced items to keep in memory at a time.
-
queueTimeout ( type=integer
| default=1000
| optional
)
- Blocking queue timeout to wait for new items in miliseconds
-
queueRetries ( type=integer
| default=3
| optional
)
- Number of retries before unblocking the queue
-
singleSubscriber ( type=boolean
| default=false
| optional
)
- If true, a single queue is created and a thread can consume the items being produced by multiple reset/advance calls to the engine.
- If false, each time an engine reset is issued, the queue is cleared (consume the queue before reset).
- Single subscriber works well with asynchronous subscription to the queue.
Get a reference to the producer stage and consume the queue
ResultsProducerStage stage = engine.getProducer("ProducerName");
String inputText = "This is a test entry";
Reader in = new StringReader(inputText);
engine.reset(in);
while(engine.advance() != null);
List<String> output = (List<String>) producer.stream().collect(Collectors.toList());
Configuration Parameters
- onlyEntities (boolean, optional) - Defaults to false. Will only include tagged entities in the output if true. Otherwise, it will include all tokens.
- whitelist (String array, optional) - Defaults to empty. If non empty, only entities of the given names in the whitelist are added to the JSON output.
- blacklist (String array, optional) - Defaults to empty. If non empty, any entity will be added to the JSON output, except for those in a blacklist.
{
"type": "JsonProducerStage",
"name": "JsonProducer",
"boundaryFlags": [
"TEXT_BLOCK_SPLIT"
],
"onlyEntities": true,
"queueTimeout": 10,
"queueRetries": 1
}
Example Output
If you have a text block like the following:
V----------[300 ml of water]----------V
^----------[300 ml of water]----------^
^-[300]-V---[ml]---V--[of]--V-[water]-^
^-[{#}]-^-[{unit}]-^-[have]-^
^-[{measurement}]--^
the stage will produce the following JSON (if onlyEntities = true):
{"entities":[{
"text":"300 ml",
"value":[
{
"value":"300",
"entity":"#"
},
{
"value":"mililiters",
"entity":"unit"
}
],
"entity":"measurement",
"startPos":0,
"endPos":6
}]}
or the following (if onlyEntities = false):
{"tokens":[
{
"text":"300 ml",
"value":[
{
"value":"300",
"entity":"#"
},
{
"value":"mililiters",
"entity":"unit"
}
],
"entity":"measurement",
"startPos":0,
"endPos":6
},
{
"text":"of",
"startPos":7,
"endPos":9
},
{
"text":"water",
"startPos":10,
"endPos":15
}
]}