News for hackers. Stuff that matters.
Re:Unofficial Apple Archive by herodotus on Thursday January 16, 2020 @01:17PM (#22067249)
My own little moment of fame: WWDC June 8, 2009, Keynote, 21 minutes and 22 seconds in: Bertrand Serlet says (about improvements to Preview): "We have added lots of little touches. The one I like...we have added a little bit of AI to actually infer the selection"

My colleague and I (we co-developed the "little bit of AI") never saw this comment (and the applause) live: we were still lining up outside of Moscone West. As Apple employees we weren't allowed in until all the guests and paying attendees had entered. Still, we watched the video afterwards and got a huge kick out of the mention.

BTW, the AI we added did not use neural nets or deep learning.

Re:Unofficial Apple Archive by bigiain on Thursday January 16, 2020 @05:05PM (#22069521)
> BTW, the AI we added did not use neural nets or deep learning.

So proper old-school AI then? Perl and regexes?

Re:Unofficial Apple Archive by herodotus on Thursday January 16, 2020 @05:45PM (#22069853)
We took a rule-based approach, coupled with some heavy-duty statistics.
Re:Unofficial Apple Archive by psadri on Thursday January 16, 2020 @06:12PM (#22070097)
That’s “AI” alright.
Re:Unofficial Apple Archive by psadri on Thursday January 16, 2020 @10:05PM (#22071487)
I didn’t mean any disrespect. My comment was meant to be humorous.
Re:Unofficial Apple Archive by bigiain on Thursday January 16, 2020 @11:26PM (#22071843)
As was mine.

(Have you _seen_ the internals of Perl's regex code? I swear it has more inexplicable random interconnectedness than most neural nets...)

Re:Unofficial Apple Archive by blowski on Thursday January 16, 2020 @01:32PM (#22067400)
That must be an amazing feeling! Is this a feature that's still in macOS today? Can I see it in action?
Re:Unofficial Apple Archive by herodotus on Thursday January 16, 2020 @01:44PM (#22067539)
The feature is there. I assume our code is still used, but it may have been rewritten since I retired. You can use this as an example if you like: https://www.extension.purdue.edu/extmedia/FNR/FNR-269-W.pdf

(which is random, but you need two columns in the PDF). Try select from column 1 near the bottom, across to column 2.

PDFs are very diverse. Our algorithm does not always work, alas, but it is significantly better than what existed before.

In fact, for some reason, it works well for this document on page 1 and 3 but not so well on page 2! But I no longer have access to the low level tools I used to use to figure out what went wrong.

Re:Unofficial Apple Archive by amartya916 on Thursday January 16, 2020 @06:36PM (#22070275)
This is so neat. Like someone else mentioned already, this feature has been very useful for me countless times. In fact, when it doesn't work, I tend to blame the PDF itself :). Thanks a ton!
Re:Unofficial Apple Archive by cfitz on Thursday January 16, 2020 @01:46PM (#22067559)
Yup, just open Preview for an image (possibly other documents as well e.g., PDF), go into “markup” mode, and begin to draw with the pen or pencil. Preview will try to “perfect” your drawn check mark, X, straight line, curved line, etc.
Re:Unofficial Apple Archive by herodotus on Thursday January 16, 2020 @01:53PM (#22067626)
That's a nice feature! But it was added after we left Apple. I cannot claim any credit for it.
Re:Unofficial Apple Archive by coldtea on Thursday January 16, 2020 @05:54PM (#22069952)
That's a different "smart" feature -- the one mentioned has to do with guessing where the selected text continues (when it goes on to a different column, text box, etc).

PDFs are more "baked" layouts rather than high level semantic markup, so it's not easy to automatically determine this. The AI is probably a set of heuristics.

Re:Unofficial Apple Archive by Angostura on Thursday January 16, 2020 @05:32PM (#22069734)
I remember this being introduced, and thought ‘that’s cool’. I use that function in Preview most days so - thank you.
Re:Unofficial Apple Archive by pschastain on Friday January 17, 2020 @08:51AM (#22074573)
And then Apple went and borked Preview by rewriting it post-Mavericks. Used to keep a VM just for it. Not sure why they decided to "fix" something that wasn't broken but to this day Preview lacks a lot of functionality it once had.

Just a bit of an aside. I'm still somewhat bitter about it :-p

Re:Unofficial Apple Archive by blub on Friday January 17, 2020 @03:03AM (#22072768)
This might explain a bug that's been bugging me for years: text selection in preview tends to fail when working with PDFs printed from Firefox (and others). The selection jumps from the cursor and includes too much text from below. If I select from below it jumps and selects from above. Not just words, but sometimes entire extra sentences or paragraphs.

This is quite similar to iOS text selection in practice: mostly works, but when it doesn't you're screwed.

Re:Unofficial Apple Archive by telegrammae on Thursday January 16, 2020 @02:13PM (#22067814)
Very interesting! Also a great reminder that AI is just a program that solves a problem in a certain way that may not need the most talked-about techniques, like deep learning.
Re:Unofficial Apple Archive by fierarul on Thursday January 16, 2020 @02:20PM (#22067872)
Just to confirm, are you the person the changed the Preview PDF text selection in newer macOS versions? o_0
Re:Unofficial Apple Archive by herodotus on Thursday January 16, 2020 @02:23PM (#22067885)
We created a low-level framework that was used by PDFKit (and hence by Preview) to change the way selection of text in PDF documents is done. We never worked on Preview itself. Since the feature is part of PDFKit, it is also available to third-party apps that use PDFKit.
Re:Unofficial Apple Archive by jakobegger on Thursday January 16, 2020 @03:28PM (#22068526)
I remember that! It's such a great feature!

Unfortunately it doesn't work correctly for the PDFs I get from my accountant.

It's one of those features that are really obvious, but probably surprisingly hard to implement.

Re:Unofficial Apple Archive by JKCalhoun on Thursday January 16, 2020 @09:12PM (#22071244)
I know you.
Re:Unofficial Apple Archive by amatecha on Friday January 17, 2020 @02:02AM (#22072500)
haha, I think I know who you are (though I don't _know you_) .. developer of Glider and Pararena, among others? :) If so, thank you for making such fun and memorable games!
Re:Unofficial Apple Archive by JKCalhoun on Friday January 17, 2020 @01:24PM (#22077519)
You are correct.