<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: HOW to count the word as there is a column about sentence in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/614879#M81474</link>
    <description>&lt;P&gt;It is a simple task.&amp;nbsp; Just count the number of elements that are created using the Words() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
string = "I like chocolate bars";
Show( Length( Words( string ) ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 21 Mar 2023 15:34:15 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-03-21T15:34:15Z</dc:date>
    <item>
      <title>HOW to count the word as there is a column about sentence</title>
      <link>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/614845#M81472</link>
      <description>&lt;P&gt;hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question about how to count the word in a column about sentences.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example, if a participant writes "I like chocolate bars" , it would be counted as 4 words. if the sample size is 100, how can I count words in this column by each participant?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best wishes,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rongyu&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:59:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/614845#M81472</guid>
      <dc:creator>Rongyu_Kuang</dc:creator>
      <dc:date>2023-06-10T23:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to count the word as there is a column about sentence</title>
      <link>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/614879#M81474</link>
      <description>&lt;P&gt;It is a simple task.&amp;nbsp; Just count the number of elements that are created using the Words() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
string = "I like chocolate bars";
Show( Length( Words( string ) ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2023 15:34:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/614879#M81474</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-03-21T15:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to count the word as there is a column about sentence</title>
      <link>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/614929#M81480</link>
      <description>&lt;P&gt;Building on what txnelson mentioned, if you have a column with strings, column: Strings, then consider something like this&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create new column: Num of Words&lt;/LI&gt;&lt;LI&gt;Set formula to&amp;nbsp;&lt;BR /&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Length( Words( :Strings ) )&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This will fill in the Num of Words column with the number of words found in the Strings column. The data type will initially be character, but you can modify the data type and modeling to your needs.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 16:04:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/614929#M81480</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-03-21T16:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to count the word as there is a column about sentence</title>
      <link>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/615430#M81518</link>
      <description>&lt;P&gt;many thanks indeed!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;may I ask another question, if I need to count the number of sentences in a string, what should I do?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 12:57:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/615430#M81518</guid>
      <dc:creator>Rongyu_Kuang</dc:creator>
      <dc:date>2023-03-22T12:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to count the word as there is a column about sentence</title>
      <link>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/615435#M81521</link>
      <description>&lt;P&gt;All of the JMP functions are defined in the Scripting Index.&amp;nbsp; The description of the Words() function shows that it allows for a second element which defines what delimiter(s) are to be used in the specification of what is a "Word".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1679490248009.png" style="width: 793px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51381iE82C5025FE18B783/image-dimensions/793x533?v=v2" width="793" height="533" role="button" title="txnelson_0-1679490248009.png" alt="txnelson_0-1679490248009.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The default delimiter is a blank.&amp;nbsp; If you change the delimiter element to specify both a period and a question mark, I believe what you will get is a separate entry in the output list, for each sentence.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 13:06:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/615435#M81521</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-03-22T13:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to count the word as there is a column about sentence</title>
      <link>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/615443#M81522</link>
      <description>&lt;P&gt;To parse out sentences you could use punctuation marks as delimiters to the words function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;sentences = "The quick brown fox jumped over the lazy dog.  Hello World!  Where's Waldo?";

slist = words(sentences, ".!?");
print(slist);

nsentences = nitems(slist);
print(nsentences);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output from the log window:&lt;/P&gt;
&lt;PRE&gt;{"The quick brown fox jumped over the lazy dog", "  Hello World", "  Where's Waldo"}
3&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Mar 2023 13:21:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/615443#M81522</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2023-03-22T13:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: HOW to count the word as there is a column about sentence</title>
      <link>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/615447#M81524</link>
      <description>&lt;P&gt;Other option could be to replace punctuation marks with "" and then check for string lengths&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

sentences = "The quick brown fox jumped over the lazy dog.  Hello World!  Where's Waldo?";
sentences_new = Substitute(sentences, {".", "!", "?"}, ""); // or regex with GLOBALREPLACE
show(sentences_new);
nsentences = Length(sentences) - Length(sentences_new);
show(nsentences);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Mar 2023 13:40:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/HOW-to-count-the-word-as-there-is-a-column-about-sentence/m-p/615447#M81524</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-03-22T13:40:38Z</dc:date>
    </item>
  </channel>
</rss>

