3 ms·
Is there any approach to guessing a single redacted word/phrase where the length of the word is revealed? (Such as in a PDF where the rectangle is automatically
by morpheuskafka 4y ago
Is there any approach to guessing a single redacted word/phrase where the length of the word is revealed? (Such as in a PDF where the rectangle is automatically drawn around the characters.)
I've wanted to build something that would if nothing else run through a list of guesses (assuming the font is the same as surrounding text) and see if any of them could match size-wise, but not sure of an easy way to deal with the PDF part of it.
- lucb1e 4y ago> not sure of an easy way to deal with the PDF part of it. If you aren't doing this so often that you need automation, you could sidestep that issue by just taking screenshots at 400% zoom or so and accurately measure how many pixels each letter (a-z) takes, as well as how many pixels a space is (the censored part might be into the spacing on each side of the word), and measure how many pixels the gap is between the words surrounding the censored part, then for word in wordlist do # Start by accounting for the spaces wordsize = charwidths[' '] * 2 for char in word do wordsize += charwidths[char] done if wordsize == gap_size then print("Possible word: " + word) endif done Probably want to do the gap_size +/- 1 or so, but that's how I'd approach this for a given document. A starting point for a wordlist on many linux systems could be `/usr/share/dict/words`.