Output of IteratingOperatorChain

pser
pser New Altair Community Member
edited November 5 in Community Q&A
Hello,

I experienced a problem with IteratingOperatorChain. I want to create two TextObjects (with the appropriate operator from the Text Plugin) and convert them to ExampleSets. For convenience I want to do the conversion inside an IteratingOperatorChain. Here is what happens: When I start the IteratingOperatorChain there are two TextObjects in the input, then one is converted to an ExampleSet, then the other is converted, too. But now when the IteratingOperatorChain is left, the second TextObject is again added to the Output, so I finish with two ExampleSets and one TextObject! Of course I could get rid of this superfluous TextObject with IOConsumer but that would get unhandy in larger processes.

Is there an elegant way of preventing IteratingOperatorChain from adding the second TextObject to its output?

Here's the process description:

<operator name="Root" class="Process" expanded="yes">
    <parameter key="logverbosity" value="error"/>
    <parameter key="logfile" value="%{process_name}.log"/>
    <parameter key="random_seed" value="-1"/>
    <operator name="SingleTextObjectInput" class="SingleTextObjectInput">
        <parameter key="text" value="&quot;&quot;"/>
        <parameter key="label" value="1"/>
    </operator>
    <operator name="SingleTextObjectInput (2)" class="SingleTextObjectInput">
        <parameter key="text" value="&quot;&quot;"/>
        <parameter key="label" value="2"/>
    </operator>
    <operator name="IteratingOperatorChain" class="IteratingOperatorChain" expanded="yes">
        <parameter key="iterations" value="2"/>
        <operator name="TextObject2ExampleSet" class="TextObject2ExampleSet">
            <parameter key="text_attribute" value="text"/>
            <parameter key="label_attribute" value="label"/>
        </operator>
    </operator>
</operator>
Thanks in advance,
Daniel
Tagged:

Answers

  • fischer
    fischer New Altair Community Member
    Hi Daniel,

    unfortunately, there is no easier way built into the IteratingOperatorChain directly. Admittedly, the current behaviour of the IteratingOperatorChain isn't particularly intuitive. This will be changed in 5.0.

    However, note that the IOConsumer can consume all TextObjects at once, so this should not be too unhandy in larger processes.

    Cheers,
    Simon