Quantcast
Channel: Active questions tagged string-manipulation - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 186

Getting the value of sentences

$
0
0

I have a list, importance, that assigns a "value" to each word in some text, like such:

{ {the, 0.9}, {and, 1}, {red, 2.1} }

And I also have a list of sentences, with no periods. What I am trying to do is get the 'value' of each of sentences, by taking each word, finding it's 'value' in importance, and then finds the sum of the values of all the words in that sentence.

Here is an example input/output:

{"the and", "red the", "and and"}{ {"the and", 1.9}, {"red the", 3}, {"and and", 2} }

I have tried all sorts of things with Table and Map, but nothing has even come close. Is there an elegant way to do this?


Viewing all articles
Browse latest Browse all 186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>