# Is there a way to pass an array through the ToneAnalyzer?

**URL:** <https://discourse.nodered.org/t/is-there-a-way-to-pass-an-array-through-the-toneanalyzer/10133>\
**Category:** General\
**Created:** [14 April 2019 17:41 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pass-an-array-through-the-toneanalyzer/10133 "2019-04-14T17:41:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nhar](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@nhar](https://discourse.nodered.org/u/nhar)\
**Post date:** [14 April 2019 17:41 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pass-an-array-through-the-toneanalyzer/10133/1 "2019-04-14T17:41:21Z")

</div>

I have an array of different texts that I need to pass separately through the ToneAnalyzer. I have to be able to access all of the analysis values afterwards.

Is there a way to do this without setting up a separate instance of the ToneAnalyzer for each text?

Thank you!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 April 2019 21:06 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pass-an-array-through-the-toneanalyzer/10133/2 "2019-04-14T21:06:52Z")

</div>

What ToneAnalyzer?

---

<div class="post-metadata">

**Author:** ![nhar](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@nhar](https://discourse.nodered.org/u/nhar)\
**Post date:** [15 April 2019 13:35 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pass-an-array-through-the-toneanalyzer/10133/3 "2019-04-15T13:35:23Z")

</div>

The Watson service through ibmcloud, via node-RED - it's [this](https://www.ibm.com/watson/services/tone-analyzer/) one I believe.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [15 April 2019 13:40 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pass-an-array-through-the-toneanalyzer/10133/4 "2019-04-15T13:40:09Z")

</div>

Hi @nhar

as you've discovered, you shouldn't assume users in this forum automatically know you're referring to any particular technology, or that you're running in any particular environment.

As far as I know, the ToneAnalyzer can only do one text at a time (@chughts may be able to correct me....)

If you have `msg.payload` set as an array of multiple texts, you can pass that to a `Split` node that will then turn that into one message per text. You can then pass each of those to a single ToneAnalyzer node, use a `Change` node to move the result to msg.payload and then a `Join` node to recombine all of those messages back into one. That approach assumes the ToneAnalyzer node doesn't modify message properties it isn't using - for the Join node to be able to automatically join messages from the Split node, it requires the `msg.parts` property to survive through the flow.

---

<div class="post-metadata">

**Author:** ![chughts](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chughts/32/139_2.png) [@chughts](https://discourse.nodered.org/u/chughts)\
**Post date:** [15 April 2019 14:23 UTC](https://discourse.nodered.org/t/is-there-a-way-to-pass-an-array-through-the-toneanalyzer/10133/5 "2019-04-15T14:23:49Z")

</div>

The Tone Analyzer can handle multiple sentences, but the input must be a single piece of text with normal punctuation, and not an array.

If you set the `Sentences` property in the node configuration to `true`. Then the tone response will be per sentence.
