Page 8 of 8

Re: Dictionary rewrite - thoughts, please

Posted: Thu Jun 29, 2017 7:10 pm
by bn
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

Re: Dictionary rewrite - thoughts, please

Posted: Thu Jul 06, 2017 11:03 pm
by bwmilby
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.

Re: Dictionary rewrite - thoughts, please

Posted: Thu Jul 06, 2017 11:49 pm
by bn
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

Re: Dictionary rewrite - thoughts, please

Posted: Tue Jul 18, 2017 4:16 am
by bwmilby
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.

Re: Dictionary rewrite - thoughts, please

Posted: Wed Jul 19, 2017 12:21 am
by bn
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 4762 times
Kind regards
Bernd

Re: Dictionary rewrite - thoughts, please

Posted: Wed Jul 19, 2017 1:44 am
by bogs
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*.

Re: Dictionary rewrite - thoughts, please

Posted: Wed Oct 25, 2017 12:41 am
by bn
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 4381 times

Kind regards
Bernd