!7 static BufferedImage img; static L texts; static ImageSurface is; static ReliableSingleThread rst; p-subst-autorestart { repeat with sleep 1 { //print("Shooting"); //img = shootScreenHidingConsole(); img = shootScreen2(); //print("Recognizing"); time { MultiSet multiSet = asCIMultiSet(onlyStringsLongerThan(1, words(lines(ocr_recognizeMultiLine(img))))); //pnl(multiSetAsMap_popularFirst(multiSet)); Set positiveWords = mechSetCI("Positive words"); Set negativeWords = mechSetCI("Negative words"); Set set = asCISet(keys(multiSet)); MultiSet plus = multiSetSetIntersection(multiSet, positiveWords); MultiSet minus = multiSetSetIntersection(multiSet, negativeWords); int score = l(plus)-l(minus); L popPlus = mostPopularEntriesFromMultiMap(3, plus); L popMinus = mostPopularEntriesFromMultiMap(3, minus); S text = "Score: " + score; if (score >= 0 && nempty(popPlus)) text += "\n" + joinWithComma(popPlus); if (score <= 0 && nempty(popMinus)) text += "\n" + joinWithComma(popMinus); //infoBox(text); flatInfoBox(escapeNewLines(text)); S imageID = score == 0 ? #1101253 : score > 0 ? #1101252 : #1101251; quickShowImage(loadImage2(imageID)); } } }