Translation using a dictionary
The events to be processed:
event Input { string value; } 
event Output { string value; } 
event Translation { 
   string raw; 
   string converted; 
}
The monitor:
monitor Translator { 
   dictionary < string, string > translations; 
 
   action onload() { 
      Translation t; 
      on all Translation():t addTranslation(t); 
      Input i; 
      on all Input():i translate(i); 
   } 
   action addTranslation(Translation t) { 
      translations[t.raw] := t.converted ; 
   } 
   action translate(Input i) { 
      if translations.hasKey(i.value) then { 
         send Output( translations[i.value] ) to "output"; 
      } 
      else { fail(i); } 
   } 
   action fail(Input i ) { 
      print "Cannot translate: " + i.value; 
   } 
}