title: How to annotate text in d3
body: <p>I have data in following format:</p>
  
  <pre><code>{'topics': [ ['word1','word2','word3'...],
  ['word11','word21','word31'...],..['word31','word22','word33'...]],
   "text":
  [{"word1":1,"weight":22},{"word2":4,"weight":2}....}] }
  </code></pre>
  
  <p>So, basically, these are data from topic models and I am trying to generate plots like in this paper <a href="http://www.cs.columbia.edu/~blei/papers/Blei2012.pdf" rel="nofollow noreferrer">http://www.cs.columbia.edu/~blei/papers/Blei2012.pdf</a> (page 2)</p>
  
  <p>So, topics consists of k topics and top words in each topic.
  Whereas "text" contains the alphabet in a document and then next to it . So for example : {"word1":1,"weight":22} says "word1" in this document is allocated to topic1 and has a weight 22..
  What I want is to annotate each word in this document by a color ?
  Is there a way to do this in d3? (I am new in d3)</p>
  
  <p><img src="https://i.stack.imgur.com/cUReG.png" alt="enter image description here"></p>