We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, All,
I was so excited to find the Shiffman videos on split and replace. I am trying to compare two files to yield a list of matching words, then have those words be highlighted within the whole-text display on the screen. I am having no luck, though, and am wondering if this kind of text-file-to-text-file comparison can be done, and if so, whether the replace function can be used to replace characteristics instead of words. So, a blue "lovely" replaces a black "lovely", font-wise, but stays in the same place on the page...
Thoughts, anyone? I would be so grateful.
Answers
Please check
https://forum.processing.org/two/discussion/comment/120544/#Comment_120544
Also
https://forum.processing.org/two/search?Search=adjectives
https://forum.processing.org/two/search?Search=adverbs
Kf
Hi, kfrajer, Thanks for the assist! Based on the example there, I wrote this, which unfortunately isn't working. I've tried fiddling around with the arrangement of blocks (meaning, I am uncertain where the function declaration for "replacer" goes), but no luck yet.
var butlerV; var huliuneg; var butlerneg;
function preload(){ butlerV = loadStrings("Odyssey_v_butler.txt"); huliuneg = loadStrings("neg_words_use.txt"); } function setup() { createCanvas(windowWidth, windowHeight); background(179, 157, 109);
} function draw() { background(179, 157, 109);
function replacer() { textSize(); textStyle(); fill(); }
}
(I'm so sorry, I cannot get the code to copy into a box correctly!)
here words from text 2 (adjectives) that appear in text 1 (poem) are highlighted in text 1. You could of course use different colors instead of green
You wrote:
in which way is the data "blue" stored in the word lovely in your example?
Chrisir