Dictionary rewrite - thoughts, please

This forum is a working group for community contributors to the LiveCode IDE included in the main LiveCode distribution.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Locked
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3975
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Dictionary rewrite - thoughts, please

Post by bn » Thu Jun 29, 2017 7:10 pm

Hi Brian,
put aValue into tSynonymsArray[tMax]["display name"]
if sCompleteDictsArray[anEntry]["Type"] is not "glossary" then
put " (Synonym of " & tKeyWord & ")" after tSynonymsArray[tMax]["display name"]
end if
your latest code reduces the clutter and works fine. I think we should use that version.

Kind regards
Bernd

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Dictionary rewrite - thoughts, please

Post by bwmilby » Thu Jul 06, 2017 11:03 pm

Looks like 9.0 DP8 will include the synonyms. In order to have TinyDict work for old and new versions, I suggest the following additions:

Code: Select all

    -- build Global Array
    -- get the whole array of all dictionary entries of all dictionaries
    local tSynonymsNeeded
    put true into tSynonymsNeeded
    dispatch function "ideDocsFetchExtensionData" to stack "revIDEDocumentationLibrary"
    put the result into sCompleteDictsArray
    set the itemDelimiter to "."
    repeat for each key anEntry in sCompleteDictsArray
        if char 1 of sCompleteDictsArray[anEntry]["display name"] is "#" then
            -- if the "#" synonym exists, then the dictionary contains synonyms
            put false into tSynonymsNeeded
        end if
        put sCompleteDictsArray[anEntry]["associations"][1] into tAssociation

Code: Select all

    -- add synonyms to dictionary array
    if tSynonymsNeeded then -- surround the entire chunk of code in the if statement
        local aValue, tSynonymsArray, tExtents, tMax

    < snip >

        end repeat
    end if
    -- end add synonyms
When the global array is built, if the entry exists for the comment synonym (#), then we know that the dictionary contains the synonyms.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3975
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Dictionary rewrite - thoughts, please

Post by bn » Thu Jul 06, 2017 11:49 pm

Hi Brian,

Thanks for the code and gratulations on your pull request

https://github.com/livecode/livecode/pull/5669

I will put this into tinyDict in the next week because I will be away for the weekend. Would like to test it a bit.

And then I will put up the tinyDict version with synonyms to livecodeShare.

Kind regards
Bernd

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Dictionary rewrite - thoughts, please

Post by bwmilby » Tue Jul 18, 2017 4:16 am

Thanks Bernd!

I've been working with the built in dictionary a bit over the past several weeks trying to see if I could tackle the white space issue. As pointed out earlier, it isn't a simple tweak of some CSS or HTML. It turns out that the page was using fixed widths for each column, so it took more than telling the page to fill the usable width (which is easy). I think that I am pretty close to something that could be used though. Here's a screen shot of what I have so far (made extra wide to show the lack of white space):
Dictionary.JPG
Updated Dictionary Screen Shot
In LC 9.0 DP 8 the list of APIs has gotten long enough that it was getting chopped off so I added a scroll bar to the menu. I'm trying to figure out how I can make it relative to the actual screen size instead of a fixed pixel size though. The filters panel is peeking out behind (looks the same as before). The other big change is that the list of terms is no longer fixed so it will scroll up allowing more of the definition to be seen. The only JS that I'm currently touching is related to the resizer to keep it working (it still needs some tweaking). I'm going to get a branch on my livecode-ide fork shortly with these changes.

So far I've made changes to api.html.template, lcdoc.css, and dictionary_functions.js - I need to update vertical_resizer.png to make it smaller (doesn't look good scaled). Any comments or things I should consider?

An earlier comment mentioned the "bug" where there is a long delay after typing the first character in the search box. Looking at the JS, I can see why that is happening. The page filters after every change to that field, so it is building a pretty long list after that first char. The search builds a string for each term that includes the first line of syntax (and the display name for DP8+) and does a regex against each entry.

P.S. Even after the update, I think that TinyDict is much more efficient at space use and is faster.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3975
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Dictionary rewrite - thoughts, please

Post by bn » Wed Jul 19, 2017 12:21 am

Hi all,

Brian Milby contributed to tinyDictinary the extraction of synonyms. He also submitted a pull request to add synonyms to the built-in dictionary

https://github.com/livecode/livecode/pull/5669

Synonyms now are part of the built-in dictionary as of LC9 DP8. TinyDictionary displays synomyms in LC version 8.1 and up.

TinyDict now is at version 0.8.2

http://livecodeshare.runrev.com/stack/8 ... Dictionary

newVersion.png
newVersion.png (6.48 KiB) Viewed 23799 times
Kind regards
Bernd

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Dictionary rewrite - thoughts, please

Post by bogs » Wed Jul 19, 2017 1:44 am

Just tried it, fantastic job from you guys!
bwmilby wrote:An earlier comment mentioned the "bug" where there is a long delay after typing the first character in the search box. Looking at the JS, I can see why that is happening. The page filters after every change to that field, so it is building a pretty long list after that first char. The search builds a string for each term that includes the first line of syntax (and the display name for DP8+) and does a regex against each entry.
Having made such a comment myself in a different part of the forum, I want to thank you for the explanation. It certainly makes sense *now*.
Image

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3975
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Dictionary rewrite - thoughts, please

Post by bn » Wed Oct 25, 2017 12:41 am

Due to changes how LC organizes dictionary data in LC 8.2 DP2 and LC 9 DP 10
tinyDictionary did not display LCB dictionary entries anymore.

TinyDictionary version 0.8.3 restores that functionality and is backwards
compatible.
Thanks James Hale for the code for the acqusition of the dictionary array.

It has been uploaded to "Sample Stacks" from inside Livecode or livecodeshare:

http://livecodeshare.runrev.com/stack/8 ... Dictionary


newVersion.png
newVersion.png (6.48 KiB) Viewed 23418 times

Kind regards
Bernd

Locked

Return to “IDE Contributors”