Notes on my evaluation of SilverDict https://github.com/Crissium/SilverDict I hope to be able to use SilverDict instead of GoldenDict in android Termux (emacs paw).
- Evaluate server, client and access via curl, on Linux desktop.
- With server on Linux, evaluate access via curl from Android Termux.
- With server on Linux, evaluate access from emacs paw on Linux.
- With server on Linux, evaluate access from emacs paw on Android.
- With server on Android, evaluate access from emacs paw on Android.
- With server on Windows, evaluate access from emacs paw on Android.
- If possible, evaluate access with authorization, which would be needed for a server on public internet.
- Download SilverDict.zip from the release page and extract it. (version 1.3.1)
- Create a new python virtual environment, to be used for building SilverDict. Then activate this new venv.
- mkdir silverdictVenv
- python -m venv silverdictVenv
- source silverdictVenv/bin/activate
- Install the requirements in server/requirements.txt with pip, in a python virtual environment.
- Optional: install the development package of Hunspell, then install the Python bindings with pip if you want to use Hunspell dictionaries.
- sudo apt install libhunspell-dev
- pip install hunspell
- Optional: install OpenCC’s shared library and the Python package if you need the feature of converting between Simplified and Traditional Chinese.
- sudo apt install libopencc-dev
- pip install opencc
- Optional: install Xapian and the Python bindings to use full-text search.
- sudo apt install libxapian-dev
- pip install –no-cache-dir xapian-bindings # That is two dashes before no-cache-dir
- pip install lxml
- Start the server
- python server/server.py
- This automatically starts a client in my web browser, At localhost:2628
- It also creates and populates directory “~/.silverdict”
- Manually add stardict dictionaries in directory “~/.silverdict/sources”
- Then, in client, select “Library” from hamburger menu at upper left. Select tab “SOURCES”. You should see “~/.silverdict/sources”
- Click on “refresh” button at upper right (next to the “+” button). This should rescan your dictionary sources. Look at what the server logs to standard output.
- Select tab “DICTIONARIES”. You should now see your dictionaries.
- python server/server.py
- Select query in the Silverdict web client, and enter a search query, for example:
horse
- You may see entries from several dictionaries.
- To test my chinese dictionary, “org”, created according to paw Chinese config page, I entered
你
- I got a response from this dictionary.
- Populate “~/.silverdict/hunspell/” directory:
- ln -s /usr/share/hunspell/de_DE.aff de.aff
- ln -s /usr/share/hunspell/de_DE.dic de.dic
- ln -s /usr/share/hunspell/en_US.aff en.aff
- ln -s /usr/share/hunspell/en_US.dic en.dic
- ln -s /usr/share/hunspell/es_ES.aff es.aff
- ln -s /usr/share/hunspell/es_ES.dic es.dic
- ln -s /usr/share/hunspell/fr.aff fr.aff
- ln -s /usr/share/hunspell/fr.dic fr.dic
- ln -s /usr/share/hunspell/pl_PL.aff pl.aff
- ln -s /usr/share/hunspell/pl_PL.dic pl.dic
- ln -s /usr/share/hunspell/ru_RU.aff ru.aff
- ln -s /usr/share/hunspell/ru_RU.dic ru.dic
- ln -s /usr/share/hunspell/sv_SE.aff sv.aff
- ln -s /usr/share/hunspell/sv_SE.dic sv.dic
- ls -lL
- In web client, select Library, tab GROUPS.
- Create groups, for example for each language, say a group “Chinese” with language code zh. Add suitable dictionaries to the group. Say dictionary “org” to the “Chinese” group.
- curl http://localhost:2628/api/query/Chinese/你
- Queries the dictionaries in group “Chinese”, for query key “你”
- The answer is returned as html.
- Queries the dictionaries in group “Chinese”, for query key “你”
- M-x eww
- At the eww prompt enter: http://localhost:2628/api/query/Chinese/你
- Queries the dictionaries in group “Chinese”, for query key “你”
- The answer is returned as html, and eww displays the interpreted html in an emacs buffer.
- Download SilverDict.zip to your Android mobile.
- The following are to be done in Termux.
- create a directory, say “silverdict” somewhere, for example “~/silverdict”
- cd into the silverdict directory.
- unzip SilverDict.zip
- ./termux-setup.sh
- The scripts ~/.shortcuts/SilverDict-Start.sh and SilverDict-Stop.sh may have been created starting with garbage string “-e “. Edit the files and remove that string.
- The SilverDict wiki suggests installing Termux:Widget. I’m unsure if that is compatible with the termux provided with Android emacs. Better stay away from it until that is clarified.
- Install stardict dictionaries under sdcard/Documents/Dictionaries
- Open a web browser at http://127.0.0.1/2628 or http://localhost:2628
- Select “Libraries” from the hamburger menu at upper left
- Select tab “SOURCES”
- Click on “refresh” button at upper right (next to the “+” button). This should rescan your dictionary sources. Look at what the server logs to ~/.silverdict/server.log
- Select tab “DICTIONARIES”. You should now see your dictionaries.
- Select query in the Silverdict web client, and enter a search query, for example: horse
- You may see entries from several dictionaries.
- To test my chinese dictionary, “org”, created according to paw Chinese config page, I entered 你
- I got a response from this dictionary.
- M-x eww
- At the eww prompt enter: http://localhost:2628/api/query/Default Group/你
- Queries the dictionaries in group “Default Group”, for query key “你”
- The answer is returned as html, and eww displays the interpreted html in an emacs buffer.
- In web client, select Library, tab GROUPS.
- Create groups, for example for each language, say a group “Chinese” with language code zh. Add suitable dictionaries to the group. Say dictionary “org” to the “Chinese” group.