<?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 can I calculate the term frequency for all the words in a field's values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170260#M48717</link>
    <description>&lt;P&gt;you have to use a lexicon. Look up the nodejs library for Word Net. Upload that library. Then build a new app in splunk. Once that is done, create a .js file that calls the word net library, then define a search manager in the .js file that returns your splunk search. Loop through all the words, and pass each one to the word net library to built a temporary sysnonym dictionary. You can optionally save this dictionary as a KV store and continually update. &lt;/P&gt;

&lt;P&gt;I know I didnt give details, but thats because it is a highly involved solution. But it is possible. Start poking around with Word Net and the capabilities. &lt;/P&gt;

&lt;P&gt;Keep in mind, that all custom Splunk apps are basically Node.js apps - at least that is my current understanding. Community, let me know if I am wrong!&lt;/P&gt;</description>
    <pubDate>Mon, 03 Apr 2017 21:01:39 GMT</pubDate>
    <dc:creator>jzapantis</dc:creator>
    <dc:date>2017-04-03T21:01:39Z</dc:date>
    <item>
      <title>How can I calculate the term frequency for all the words in a field's values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170256#M48713</link>
      <description>&lt;P&gt;I am trying to calculate some term frequency on the field. The field is defined as follow. &lt;BR /&gt;
&lt;CODE&gt;rex field=_raw "Notes : (?.*)"&lt;/CODE&gt; &lt;BR /&gt;
And, the field is generated correctly, but it hasn't any format, such as:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Notes :&lt;BR /&gt;&lt;BR /&gt;
Notes : Troubleshooting, I am simply reinstalling.&lt;BR /&gt;
Notes : program would not start. I am reinstalling. &lt;BR /&gt;
Notes : Made MacBook too slow &lt;BR /&gt;
Notes : computer to slow when using the program! Need to install it into another! &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;There are thousands line of information, and I want to know the term frequency of all the words in the field of notes.  I'd like to know whether there is a command to do this, or how can I achieve this in splunk.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;BR /&gt;
Thanks, Yi&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2014 10:29:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170256#M48713</guid>
      <dc:creator>mhqssyh</dc:creator>
      <dc:date>2014-12-29T10:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I calculate the term frequency for all the words in a field's values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170257#M48714</link>
      <description>&lt;P&gt;Here is a related post.... &lt;A href="http://answers.splunk.com/answers/62413/how-to-extract-most-popular-words-from-the-source-data.html"&gt;http://answers.splunk.com/answers/62413/how-to-extract-most-popular-words-from-the-source-data.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I think the REX from that post should get you going in the right direction. I've pasted the REX below.  Please see the original for more details.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*mybook* | sort -_time | rex mode=sed "s/(\.|,|;|=|\"|'|\(|\)|\[|\]| -|!|^-)/ /g" | eval word=_raw | makemv delim=" " word | mvexpand word | eval word=lower(word) | eval position=1 | streamstats sum(position) AS position | table position word | stats count min(position) max(position) by word 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Dec 2014 18:18:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170257#M48714</guid>
      <dc:creator>jimodonald</dc:creator>
      <dc:date>2014-12-29T18:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I calculate the term frequency for all the words in a field's values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170258#M48715</link>
      <description>&lt;P&gt;Thanks, jimodonald! I tried the REX. It works. But now I have another question that can I cluster some similar words to one class, such as fast, quick, rapid, swift.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Dec 2014 01:54:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170258#M48715</guid>
      <dc:creator>mhqssyh</dc:creator>
      <dc:date>2014-12-30T01:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I calculate the term frequency for all the words in a field's values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170259#M48716</link>
      <description>&lt;P&gt;Splunk is not going to know what words are synonyms.  It could likely be done with a case statement or a lookup table.  Either way the synonyms would need to be identified and linked back to a common word.  &lt;/P&gt;</description>
      <pubDate>Tue, 30 Dec 2014 16:27:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170259#M48716</guid>
      <dc:creator>jimodonald</dc:creator>
      <dc:date>2014-12-30T16:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I calculate the term frequency for all the words in a field's values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170260#M48717</link>
      <description>&lt;P&gt;you have to use a lexicon. Look up the nodejs library for Word Net. Upload that library. Then build a new app in splunk. Once that is done, create a .js file that calls the word net library, then define a search manager in the .js file that returns your splunk search. Loop through all the words, and pass each one to the word net library to built a temporary sysnonym dictionary. You can optionally save this dictionary as a KV store and continually update. &lt;/P&gt;

&lt;P&gt;I know I didnt give details, but thats because it is a highly involved solution. But it is possible. Start poking around with Word Net and the capabilities. &lt;/P&gt;

&lt;P&gt;Keep in mind, that all custom Splunk apps are basically Node.js apps - at least that is my current understanding. Community, let me know if I am wrong!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 21:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170260#M48717</guid>
      <dc:creator>jzapantis</dc:creator>
      <dc:date>2017-04-03T21:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I calculate the term frequency for all the words in a field's values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170261#M48718</link>
      <description>&lt;P&gt;I used the following syntax to count the frequency of terms in my field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;              | rename COMMENTS_4 AS text
              | rex mode=sed field=text "s/[,|.|!]/ /"
              | makemv text
              | mvexpand text
              | eval wordCount = mvcount(text)
              | stats sum(wordCount) as "Word Map Text Analysis" by text
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the line: &lt;CODE&gt;| rename COMMENTS_4 AS text&lt;/CODE&gt;&lt;BR /&gt;
just names my field variable to "text". So assuming you rename your field variable with text, you can count the terms using MV* commands&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 15:54:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-the-term-frequency-for-all-the-words-in-a/m-p/170261#M48718</guid>
      <dc:creator>jzapantis</dc:creator>
      <dc:date>2017-04-04T15:54:48Z</dc:date>
    </item>
  </channel>
</rss>

