How to update a code that display a word-cloud with new words?

Hi everyone
I’m doing an installation for a project, this is my stand point.

What do I want to achieve: A program that display a word-cloud (the more a specific word has been say, the bigger it appears in the word cloud). The input will be a microphone, the program will detect the word and then display it. (it will start with 0 word displayed and then the number will incresce depending on how oft people will interact with it). Everytime a new word is add in the cloud the font-size of the other words that are already displayed should change and adapt in order to keep the chart true).

The code now: The code integrate the function to detect the word from the microphone and display it in the console (when i try to save the word in the text file, it delate everything there’s on it. why that?). The text to form the cloud now is taken from an external text file (witch is not necessary but I keep it for testing). When I run the sketch and I edit the text file (already full) and save it (with the sketch running) it does not update the cloud. I can’t really understand why. If I run the sketch with only one word on it, then I add a new one and I save the text file, the code some times display the new word other times he just repeat the last word he displayed.

How can I add new words coming from the mic in the cloud while the program is running and adapt the words that are already been displayed in order to keep the chart true?

here a link to download the zipped code with the text file and font

void draw() {
  //while(currentIndex < words.length) /changed while with if under
    if(currentIndex < words.length) {
    float relsize = map(count[currentIndex],least,most,minSize,maxSize);
    boolean drawn = false;  
    while (!drawn) {
      drawn = drawWord(words[currentIndex], relsize);
      if (!drawn)
       println("redrawing "+words[currentIndex]);
        relsize = relsize * 0.95;

void webSocketServerEvent(String msg) {
  println(msg); // print dectected text from micorphone
  String[] voice = split(msg, ' ');
  saveStrings("H-Farm.txt", voice);

void initializeWords() {
  ArrayList ignore = new ArrayList();
  String[] ignoreStrs  = loadStrings("ignora.txt");
  for (int i = 0; i < ignoreStrs.length; i++) {
  HashMap wordcount = new HashMap(); // similar to array but for string
  String[] lines = loadStrings(wordFile); // upload tex file
  for (int i = 0; i < lines.length; i++) {
    String[] words = split(lines[i], " ");  
    for (int j = 0; j < words.length; j++)  {
      String word = clean(words[j]).toUpperCase();
      if (word.length() == 0) {
      if (ignore.contains(word)) {
      Integer count = (Integer)wordcount.get(word); 
      if (count == null) {
         wordcount.put(word, new Integer(1));
       else {
         int newCount = count.intValue() + 1;
         wordcount.put(word, new Integer(newCount));
  words = new String[wordcount.size()];
  count = new int[wordcount.size()];
  int idx = 0;
  Iterator it = wordcount.entrySet().iterator();  // Get an iterator
  while (it.hasNext()) {
      Map.Entry me = (Map.Entry);
      words[idx] = (String)me.getKey();
      count[idx] = ((Integer)(me.getValue())).intValue();