Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Challenge: Duplicating Many Eyes Word Tree with R

Tags:

r

Many eyes, an IBM data visualization experiment, provides a very interesting method of visualizing continuous text (like speeches, or phrases). Essentially, you choose a start word and it creates something akin to a dendrogram or tree for all the sentences that follow that word, generally broken up by the verb that follows the chosen word.

enter image description here

There's an example here: http://www-958.ibm.com/software/data/cognos/manyeyes/page/Word_Tree.html

While there are some interactive components, I just care about the graphic itself.

Is there an existing way to do this in R? If not, can you think of a way to do it (in R)? I'm at a loss for how they break it down. I'd hive off rep for a solution but will accept a well thought out idea as well.

like image 531
Brandon Bertelsen Avatar asked Nov 25 '12 02:11

Brandon Bertelsen


1 Answers

google made a fantastic contribution for this with google charts tool

https://developers.google.com/chart/interactive/docs/gallery/wordtree

you can easly generate your own by implicit script in above link - mine is Turkish

just change data array as below.

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
  google.charts.load('current', {packages:['wordtree']});
  google.charts.setOnLoadCallback(drawChart);

  function drawChart() {
    var data = google.visualization.arrayToDataTable(
      [ ['Phrases'],
        ['abd adalet bakanligi fiat chrysler sorustur'],
        ['abd adalet bakanligi fiat chrysler sorusturma acti'],
        ['abd adalet bakanligi fiat chrysler sorusturma acti abd adalet bakanliginin fiat chrysler fca hakkinda dizel'],
        ['abd adalet bakanligi fiat chrysler sorusturma acti abd adalet bakanliginin fiat chrysler fca hakkinda dizel araclarinda emisyon'],
        ['abd adalet bakanligi fiat chrysler sorusturma acti haberin detaylari icin tiklayiniz'],
        ['abd adalet bakanligi fiat chrysler sorusturma acti kazakistan haber'],
        ['abd adalet bakanligi fiat chrysler sorusturma acti sondakika'],
      ]
    );

    var options = {
      wordtree: {
        format: 'implicit',
        word: 'cats'
      }
    };

    var chart = new google.visualization.WordTree(document.getElementById('wordtree_basic'));
    chart.draw(data, options);
  }
</script>
<body>
<div id="wordtree_basic" style="width: 900px; height: 500px;"></div>
</body>
like image 50
Selcuk Akbas Avatar answered Sep 19 '22 17:09

Selcuk Akbas