AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dictionary software, Babylon alternative?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat
View previous topic :: View next topic  
Author Message
delta



Joined: 16 Feb 2005
Posts: 44

PostPosted: Wed Aug 24, 2005 5:03 pm    Post subject: Dictionary software, Babylon alternative? Reply with quote

Do you know any good alternative to Babylon? I like WordWeb a lot, but you cannot build your own dictionaries easily or at least download them. Well, you can however buy WordWeb Developer, but there seems to be no community, so you have to make all dictionaries yourself...

Is there a freeware or even open source software that fills this gap? I've tested jDictionary, but it seems not very active (last version from 2002) and you can't make your own dictionaries either. Being able to make your own dictionaries is an important feature for me, since if it's not English, Spanish, French or German it get's hard to find something good.

Well, thinking again: What do you think of making a dictionary software with AHK? It could/should be modeled upon WordWeb. The first dictionary could be the AHK help file. Wink Above all it must be light-weight and small. I don't like dictionaries that clutter the whole screen and takes ages to launch. Do you think it will be any good? I would try it, but maybe AHK is not the right choice for something?
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Wed Aug 24, 2005 5:12 pm    Post subject: Reply with quote

The problem is to get the database.
Interfaces to the users can be done in nearly all languages. But with AHK it is easy.
If you can get a translation with URLDownloadToFile from WordWeb, it should be pretty easy.

Have a look at
http://www.autohotkey.com/forum/viewtopic.php?t=44
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Wed Aug 24, 2005 5:15 pm    Post subject: Reply with quote

Or have a look at this:
Code:
URLDownloadToFile, http://pda.leo.org/?search=%clipboard%, LEOutput.txt
Found := False
Line =
Loop, Read, LEOutput.txt
  {
    IfInString, A_LoopReadLine, Unmittelbare Treffer
      {
       Line = %Line%%A_Tab%%A_LoopReadLine%
       Found := True
      }
    Else IfInString, A_LoopReadLine, Verben und Verbzusammensetzungen
      {
       Line = %Line%%A_Tab%%A_LoopReadLine%
       Found := True
      }
    Else IfInString, A_LoopReadLine, lieferte keine Treffer
      {
        MsgBox, Leo lieferte keine Ergebnisse
        Found := False
        break
      }
  }
FileDelete, LEOutput.txt

If Found
  {
    StringReplace, Line, Line, %A_Tab%,, All
    StringReplace, Line, Line,  ,, All
    StringReplace, Line, Line, Forumsdiskussion,, All
    StringReplace, Line, Line, ENGLISCH,, All
    StringReplace, Line, Line, DEUTSCH,, All
    StringReplace, Line, Line, .gif"></a></td, , All
    StringReplace, Line, Line, </tr>,`n, All
    StringReplace, Line, Line, </td>, %A_Tab%, All
    Loop
      {
        StringReplace, Line, Line, %A_space%%A_space%,%A_space%, All
        StringReplace, Line, Line, %A_space%`n,`n, All
        StringReplace, Line, Line, `n%A_space%,`n, All
        StringReplace, Line, Line, %A_Tab%`n,`n, All
        StringReplace, Line, Line, `n%A_Tab%,`n, All
        StringReplace, Line, Line, `n`n,`n, All
        StringGetPos, FirstPos, Line, <
        If ErrorLevel
            break
        StringGetPos, SecondPos, Line, >
        StringLen, Length, Line
        StringLeft, LineFront, Line, %FirstPos%
        StringRight, LineBack, Line, % Length - SecondPos - 1   ;%
        Line = %LineFront% %LineBack%
      }

    Text =
    Loop, Parse, Line , `n
       If A_LoopField is space
           Text = %Text%
       Else IfInString, A_LoopField , %A_Tab%
           Text = %Text%`n%A_LoopField%
       Else IfInString, A_LoopField , Link zu
           Text = %Text%
       Else
           Text = %Text%`n`n  %A_LoopField%`n

    MsgBox, Die Übersetzung gemäß LEO: %Text%
  }
Else
    MsgBox, Habe nichts in der Datei Leo gefunden,`nevtl. muss mein Admin die Suche in der Datei verfeinern.


_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
delta



Joined: 16 Feb 2005
Posts: 44

PostPosted: Wed Aug 24, 2005 5:37 pm    Post subject: Reply with quote

Yup, I thought about something like a "front end", too. That could be a component.

The database can be built by hand. It will never be as big as a "true" dictionary if you do it alone but in exchange it has the words you need. A good English dictionary is nice, but if you look for a technical or very special term or a word from another language it quickly get's useless. Long ago I used Babylon (I think it was still freeware then Laughing ) and there were tons of dictionaries by users. Some only as big as hundred words or even smaller, but since you could look them up simutaneoulsy it was useful.
Back to top
View user's profile Send private message
deguix



Joined: 26 Aug 2004
Posts: 72
Location: Everett - MA, USA

PostPosted: Wed Aug 24, 2005 8:33 pm    Post subject: Reply with quote

It would be more interesting doing a script for AHK that does this than making use of other programs. AHK has lots of mouse and control text capturing scripts already. And besides, it could even be better than Babylon, depending on the way it's implemented. For example, it could be nice to have an option to see the meaning of a word just by hovering it.

Of course, this it would be quite an effort... creating lots of dictionaries and GUI and etc... You see that Babylon passed through 5 major versions already.
_________________
Working now on:
NSIS Wiki (NSIS)
Back to top
View user's profile Send private message
delta



Joined: 16 Feb 2005
Posts: 44

PostPosted: Thu Aug 25, 2005 3:22 pm    Post subject: Reply with quote

I tried something quick here: Tool Tip Dictionary. It's not what I actually wanted since it bears no resemblance to WordWeb but in fact I use this more often than WordWeb. Wink

Deguix, is it yet possible to capture the text under the mouse pointer? I thought this was something for next AHK versions?

Capturing from other web sites is a nice thing but still does not help me too much. Actually I'm looking for a portuguese dictionary. The site which I use for my Tool Tip Dic has one but it's not particulary bright. It knows corrigir (infinitive) but not corrijo (inflected), so it's not of much use if you're weak at irregular verbs. However, I've found a portuguese-portuguese dictionary which knows irregular verbs, but does not translate... but maybe I can use a script to bind both together. Hm... but accessing several websites might slow a script, so maybe I can build an offline repository for words already looked up. But still there are words that cannot be found, that's why I think an option to manually add words is essential. But maybe I can skip this if you bind together all portuguese dictionaries? Very Happy

Well, anyhow, I'm just thinking. Next thing: What about small dictionaries? Imaginge one that shows the AHK commands (maybe just the prototype so that you know how much variables you need and where to put each) Just building it up along with your programming might be more efficient than first writing a script which extracts the info from the website.

Writing an extracting script always is a new task. It's hardly possible to use old scripts for this. But if you have a script (or template) to build dictionaries you have something you can always use. And especially if you bind together dictionaries from other users it can be faster than extracting websites. That's something that makes wikipedia so effective.
Back to top
View user's profile Send private message
deguix



Joined: 26 Aug 2004
Posts: 72
Location: Everett - MA, USA

PostPosted: Fri Aug 26, 2005 12:18 am    Post subject: Reply with quote

My primary language is Portuguese.

Quote:
Deguix, is it yet possible to capture the text under the mouse pointer? I thought this was something for next AHK versions?

Hmmm... It will be difficult to do this, but I might have an idea of using it with C++ API (I have no experience on doing this, this is just my hypothesis):

1) Detect the text and the control rectangle coordinates below the cursor.
1.A) Detect the window behind the point. (ChildWndFromPoint)
1.B) Get the control's text (SendMessage with WM_GETTEXT generally). If the control doesn't have text, then don't continue.
1.C) Get the control's coordinates (GetWindowRect).
2) Get the control's DC (GetDC).
3) Calculate the characters positions. (GetCharacterPlacement)
4) Compare the current mouse position with all the characters positions.
5) If one of them matches, assign the character position to its respective character value.
6) Detect which word was selected: If the word has a space before or after it, then get the text between those. If the word has punctuation in the end or start, like a period or a colon, then ignore the character and detect the word found. (can be changed to support entire sentences) This depends on the language.

Now the rest is just extra stuff, like drawing a rectangle around the selected text. You can do this like this:
1) Detect the inverse colors for the text and background. Just do 0xFFFFFF - color. (GetBkColor and GetTextColor)
2) Detect the rectangle of the text. Just detect the differences of position between the start and end characters. If the word is split to the next line, then two rectangles will be needed to detect.
3) Draw the selected text with inverse colors. (ExtTextOut)
_________________
Working now on:
NSIS Wiki (NSIS)
Back to top
View user's profile Send private message
Decarlo110



Joined: 15 Dec 2004
Posts: 303
Location: United States

PostPosted: Fri Aug 26, 2005 6:15 pm    Post subject: Reply with quote

one of many gems waiting to be found in the forum...
credit goes to corrupt for sharing this one

Get Word Under Mouse (DLL)
_________________
1) The Open Source Definition http://www.opensource.org/docs/definition_plain.php

2) Intuitive. Logical. Versatile. Adaptable. <<AutoHotkey>>
Back to top
View user's profile Send private message
deguix



Joined: 26 Aug 2004
Posts: 72
Location: Everett - MA, USA

PostPosted: Sat Aug 27, 2005 6:08 pm    Post subject: Reply with quote

Sweet. With this, we now just need a dictionary and a GUI.

The Tool Tip Dictionary script uses lookwayup.com dictionaries, but if a GUI is created, then it'll be easy to implement wiktionary based script. There is always dump files which to search words from. But there is more, it would be even better to actually change a word definition from the GUI. My skills in the pywikipedia bot could be in help to make things easier for you to edit pages directly from the GUI itself.

This would be perfect! You would be able to edit wiktionary pages directly from AHK itself! Very Happy
_________________
Working now on:
NSIS Wiki (NSIS)
Back to top
View user's profile Send private message
Loriss



Joined: 26 Jul 2004
Posts: 64

PostPosted: Sun Sep 25, 2005 11:08 am    Post subject: Reply with quote

Could be useful kbabel?
http://freshmeat.net/projects/kbabel/

Open Source ,it is used under KDE in order translate interfaces and handbook.
There are many database and dictionaries to disposition.
_________________
Loriss
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group