• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How is "Apple + Ctrl + D" implemented?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How is "Apple + Ctrl + D" implemented?


  • Subject: Re: How is "Apple + Ctrl + D" implemented?
  • From: Nathan Vander Wilt <email@hidden>
  • Date: Wed, 30 Apr 2008 08:00:00 -0700

On Apr 28, 2008, at 5:35 AM, John Joyce wrote:
Graham,

Thanks for your reply! But how can I "find the range of the word" given
the glyph index? I just can not find an API doing so.
[snip]
The range of the word is up to you to find and depends on the language. If it is any common language from Europe, your job is a lot easier. You mainly need to work with whitespace and punctuation. If you're working with Japanese, you'll need to learn of lot of complex tricks to identify the range of words...[snip]


"Nota bene" that the popup/Cmd-Ctrl-D dictionary does not look up single words only. Try it on that Latin phrase, and it's not just because of the quotes.

The heuristic seems to be the longest main entry that matches (exactly after normalization?).

It finds "ablative absolute" and "a cappella" and "Aaron Copland", over "ablative" and "a" and "Aaron" (and "nota" above). Thus, there seems to be no way to pop up a definition for "a capella" [sic], only "a" and "capella", as was confusing me until I realized my mispelling. Any "stemming" seem to be handled by either dictionary entries ("ablative absolutes" shows in Dictionary.app's list although it pulls up the singular entry), or finally by word boundaries (compare "Aaron Coplands" to "Aaron Copland's").

The main entry category doesn't seem to include phrases, as "a bit much" is findable in Dictionary.app, but not in the popup panel. The exactly part seems to come from "nota bene" (with two regular spaces) failing. Inserting a single U+2003 EM SPACE also causes failure, but not a U+00A0 NO-BREAK SPACE (which might be explained in terms of normalization before matching?).

Of course, this is all just tested on words in the Oxford English, testing on Japanese text may reveal subtleties that affect the heuristic, which was deliberately vague about whether longest is in terms of words or characters (words seems most likely, so the previous discussion is still relevant).



What none of this explains is why Preview.app won't give a pop-up dictionary even when a PDF has selectable text (which can be pulled up in Dictionary.app). For me, that would be an interesting explanation to hear.


thanks, -natevw _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How is "Apple + Ctrl + D" implemented?
      • From: Evan Gross <email@hidden>
References: 
 >Re: How is "Apple + Ctrl + D" implemented? (From: John Joyce <email@hidden>)

  • Prev by Date: Icons on the NSTabview
  • Next by Date: Re: Cache Class review (low priority)
  • Previous by thread: Re: How is "Apple + Ctrl + D" implemented?
  • Next by thread: Re: How is "Apple + Ctrl + D" implemented?
  • Index(es):
    • Date
    • Thread