Giter Club home page Giter Club logo

ayandict's Introduction

AyanDict

A simple cross-platform desktop dictionary application based on Qt framework and written in Go that uses StarDict dictionary format.

It is designed for desktop and it should run on every desktop operating system that Qt supports. It is tested on Linux and Windows, and it should run perfectly on Mac, FreeBSD and other modern Unix-like systems. I will upload binaries for Linux, Windows and Mac (and maybe FreeBSD).

StarDict is the only supported format for now, and by default, it reads all StarDict dictionaries in ~/.stardict/dic folder. But you can change the folder or add more folders through configuration.

Installation

If you don't have Go language on your system, you can check Releases and download the latest binary for your platform if available.

If you have Go, you can compile and install the latest code with

go install github.com/ilius/ayandict/v2@latest

Or clone the repository, cd to it and run go build, which will create the binary (ayandict.exe or ayandict) in this directory.

It's good to know that the binary / executable file is completely portable, so you can copy it anywhere you want and run it from there (although on Unix the storage must support executable files).

Screenshots

Linux - light style (default)


Linux - dark style (Breeze) + Favorites


Windows - light style (default)


Windows - dark style (Breeze)


Most Frequent queries


Dictionaries dialog


Misc tab


Configuration

To change configuration (which includes most user settings), you have to edit the config file (we do not have GUI for it, and no plan to add it, sorry!).

After you run the program, you can click on "Config" button (as seen in screenshots) and it will open the config.toml file in your default text editor (for TOML files).

If config.toml does not exist, it will be created and filled with default config.

After you modify config.toml, you can click on "Reload" button (next to "Config" button) and it will apply the changes.

The full path for config.toml file:

  • Linux: ~/.config/ayandict/config.toml

    • If $XDG_CONFIG_HOME is set: $XDG_CONFIG_HOME/ayandict/config.toml
  • Windows: C:\Users\USERNAME\AppData\Roaming\AyanDict\config.toml

    • More accurately: %APPDATA%\AyanDict\config.toml
  • Mac: ~/Library/Preferences/AyanDict/config.toml

Here is a list of all config parameters.

Dictionaries

As you see in screenshots, there is a button called "Dicts" or "Dictionaries". It opens a dialog and lets you disable, enable and change order of dictionaries.

Each dictionary has a "Symbol" which by default is the first letter of its name in curly brackets (for example [W] for WordNet). This symbol is shown in the list of results that is in the left side of window, as seen in screenshots. It is meant to show you which dictionary it comes from at first glance. You can change this symbol through "Dictionaries" dialog. Symbol can be empty, or be as long as you want (though it is 3 characters by default).

Convert other Dictionary formats

You can use PyGlossary to convert various other formats to StarDict format and use them for this application. A list of supported formats is provided, and if you click on each format's link, it will lead you to more information about it.

Download Dictionaries

There are tons of web pages that let you download various usable dictionaries, but here is a list I collected (feel free to open a pull request for more):

Keyboard bindings/shortcuts

  • Escape: clear the input query and results
  • Space: (while query entry is not focused) change keyboard focus to query entry
  • + or =: Zoom in (article/definition/translation)
  • -: Zoom out (article/definition/translation)

Search Algorithm

The default search is fuzzy, and it is based on similarity scores that are calculated from Levenshtein distance. We also split entry terms into words, for example if you type "language" (or with with a few misspelled letters, like "languge"), it first shows "language", and then terms like "language learning", but may also show terms like "sign language".

If you specifically want terms with "language" as the second word, you can type "* language". We do not support pattern matching (yet), and you can only use * alone (not as part of a pattern).

Anything with at least %70 similarity score is listed (for example "languge" is %87 similar to "language"). But we have a limit of how many results are displayed, and by default it's 40 results. You can change this with config parameter max_results_total.

This works pretty well in most cases, but the only catch is that first letter of your query must match the first letter of one of your target words. For example if you type "symmetry", it will not match term "asymmetry" even though they are close enough (high similarity score), because their first letter is different.

But we also have 3 other search modes added in v2.0.0:

  • Start with, shows all terms that start with given string
  • Regex (regular expression), for example .*symm.*
  • Glob, for example *symm*

ayandict's People

Contributors

ilius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ayandict's Issues

web app / docker?

Hi Saeed, Salam,
Have you ever thought about creating a web application out of ayandict? in order to be able to deploy it and use it as a self-hosted application?
I have found a project for MDICT files (django-mdict), but the user interface is completely in Chinese.
Best Regards,
Shahram

panic: runtime error: invalid memory address or nil pointer dereference on macos

I downloaded the release version for darwin to use on macos 13. It launched fine, but crashed while searching for a word.
Maybe because the paths seem to be hardcoded.

$ ./ayandict-darwin-x86_64
looking for qtbox in: /Users/user/Downloads/qtbox
final qtbox location: /Users/user/Downloads/qtbox
2023/04/24 19:01:37 Initializing "/Users/user/Documents/GoldenDict/Sr/Wiktionary (Sr-En)/Wiktionary (Sr-En).ifo"
2023/04/24 19:01:37 gzip: invalid checksum
2023/04/24 19:01:37 Loading dictionaries took 612.831179ms
2023/04/24 19:01:41 dictName="Wiktionary (Sr-En)", ds=<nil>
2023/04/24 19:01:50 Search index loop took 25.671164ms for "mrlja" on Wiktionary (Sr-En)
2023/04/24 19:01:50 LookupHTML took 25.708861ms for "mrlja"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x1f967c6]

goroutine 8 [running]:
github.com/ilius/ayandict/pkg/stardict.(*Dict).GetSequence(0xc005de5748?, 0x1fa7dec?, 0xc00009a7e0?)
	C:/Users/Saeed/go/src/github.com/ilius/ayandict/pkg/stardict/dict_unix.go:13 +0x26
github.com/ilius/ayandict/pkg/stardict.(*Dictionary).Search.func2()
	C:/Users/Saeed/go/src/github.com/ilius/ayandict/pkg/stardict/dictionary.go:159 +0x31
github.com/ilius/ayandict/pkg/stardict.(*QueryResultImp).DefinitionsHTML(0xc005f315f0)
	C:/Users/Saeed/go/src/github.com/ilius/ayandict/pkg/stardict/stardict.go:62 +0x62
github.com/ilius/ayandict/pkg/application.(*ResultListWidget).OnActivate(0xc004558370, 0x0?)
	C:/Users/Saeed/go/src/github.com/ilius/ayandict/pkg/application/query.go:118 +0x6a
github.com/ilius/ayandict/pkg/application.NewResultListWidget.func1(0x0?)
	C:/Users/Saeed/go/src/github.com/ilius/ayandict/pkg/application/query.go:50 +0x32
reflect.Value.call({0x21557a0?, 0xc0045786d0?, 0x28267c0?}, {0x2441eea, 0x4}, {0xc005dd2138, 0x1, 0x1106fa5?})
	C:/Program Files/Go/src/reflect/value.go:584 +0x8c5
reflect.Value.Call({0x21557a0?, 0xc0045786d0?, 0xc004cfcfa8?}, {0xc005dd2138?, 0x215f060?, 0x0?})
	C:/Program Files/Go/src/reflect/value.go:368 +0xbc
github.com/therecipe/qt/internal.handleCallback({0xc00527cd45, 0x2e})
	C:/Users/Saeed/go/pkg/mod/github.com/therecipe/[email protected]/internal/internal.go:73 +0x2fd
github.com/therecipe/qt/internal.syncCallbackHandler({0xc00527cd45?, 0x0?})
	C:/Users/Saeed/go/pkg/mod/github.com/therecipe/[email protected]/internal/internal.go:113 +0x1e
created by github.com/therecipe/qt/internal.InitProcess.func3
	C:/Users/Saeed/go/pkg/mod/github.com/therecipe/[email protected]/internal/internal.go:409 +0x1aa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.