crissium / silverdict Goto Github PK
View Code? Open in Web Editor NEWWeb-Based Alternative to GoldenDict
Home Page: https://silverdict.lecoteauverdoyant.co.uk
License: GNU General Public License v3.0
Web-Based Alternative to GoldenDict
Home Page: https://silverdict.lecoteauverdoyant.co.uk
License: GNU General Public License v3.0
System is Android 13 on Google Pixel 6 Pro. Attempted step
on Termux:
pip3 install flask
pip3 install fask-cors
pip3 install waitress
pip3 install requests
apt install yarn
scp the zip file downloaded from github to termux, unzip it and enter the directory
cd client
yarn install
yarn build
mv dict ../http_server
cd ../
python 3.11 http_server/http_server.py
python 3.11 server/server.py
Any help in getting it to work would be most appreciated!
Hi! I stumbled with this project by chance, and this is exactly what I had been hoping existed! I had been wanting to be able to self-host my GoldenDict collection. Thanks for putting this together; the demo looks very good.
However, I'm having trouble installing this in a Synology NAS using Docker. I'm using the ready-built image from Docker Hub, so I put together the following compose file:
version: '3.9'
services:
silverdict:
image: mathdodger/silverdict:latest
container_name: SilverDict
restart: unless-stopped
user: 1029:100 # "docker" user:"users" usergroup
ports:
- 2628:2628
volumes:
- /volume1/Docker/SilverDict/data/:/home/silverdict/.silverdict/ # Default folder
- /volume1/Docker/SilverDict/cache/:/home/silverdict/.cache/SilverDict/ # Optional mounting of cache
- /volume1/Dictionaries/_New dictionary library/:/dictionaries/ # Dictionary library; to be configured later
But I'm getting a few errors on the log, most notably about permission on certain folders. But I'm sure the user I defined has read and write permissions on the mounted folders.
The folowing is the logfile:
Hi there, I found this project when searching for an alternative of Goldendict, since it no longer works on newer version of Android.
I have always wanted to have a commandline dictionary look up tool for stardict and ABBYY DSL dictionary format, with a web based front end, so that it would be extremely portable and easy to maintain. For example, I envision using this on Android on Termux, running a local browser and accessing the dictionary interface on a local browser. This way none of those scope storage troubles or any future API changes would destroy the function of the the app.
I myself is not a real programmer (I only code for my scientific work, in C and Fortran, mostly numerical works run on large clusters). But I have started collaborating with two experienced programmers and we made some progress in achieving this goal.
One result is this project https://github.com/proteusx/lectus But it has since stalled because the programmer in question prefer perl, and is not very well versed in the web interface side. Nonetheless, that project achieved much success in producing a commandline parser for DSL format and converting all its tags (e.g. colors) into html and can be displayed in a rudimentary web interface. The DSL dictionary is also indexed in sqlite database, with excellent search performance.
I also kept a decade-long correspondence with the developer of this project
https://www.lesbonscomptes.com/recoll/pages/index-recoll.html
And he has kindly coded, in python, two very modular searching and indexing code, which can index the dictionaries, in both stardict and DSL format, in a sqlite database, and can search and retrieve the raw entries with excellent performance. (in a few tenths of seconds on Android phone via termux even for lexicon with million entries, and scaling well with number of entries).
Given your expertise in web development, I see a possible synergy in putting what my two friends already achieved into your project and reaching our shared goal a lot more quickly.
If you're interested in collaborating, perhaps we could get in touch by email. My email address is just like my github username, but instead of the dash in between my first and last name there is a dot, and the email domain name is gmail. Please reach out to me and I can send you my second friend's python modules to index the DSL and stardict format into an sqlite databse and we can see what's the best way to proceed.
hi there,
i did yarnpkg build
, but there is no "http_server" to move
i got this :
(sd) root@lxcSilDict:/home/SilverDict/client# yarnpkg build
yarn run v1.22.19
$ react-scripts build
Creating an optimized production build...
One of your dependencies, babel-preset-react-app, is importing the
"@babel/plugin-proposal-private-property-in-object" package without
declaring it in its dependencies. This is currently working because
"@babel/plugin-proposal-private-property-in-object" is already in your
node_modules folder for unrelated reasons, but it may break at any time.
babel-preset-react-app is part of the create-react-app project, which
is not maintianed anymore. It is thus unlikely that this bug will
ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
your devDependencies to work around this error. This will make this message
go away.
Compiled with warnings.
[eslint]
src/DesktopApp.js
Line 96:5: React Hook useEffect has missing dependencies: 'query' and 'search'. Either include them or remove the dependency array react-hooks/exhaustive-deps
Line 128:5: React Hook useEffect has missing dependencies: 'latestSuggestionsTimestamp' and 'resetDictionariesHavingQuery'. Either include them or remove the dependency array react-hooks/exhaustive-deps
src/MobileApp.js
Line 102:5: React Hook useEffect has missing dependencies: 'query' and 'search'. Either include them or remove the dependency array react-hooks/exhaustive-deps
Line 128:5: React Hook useEffect has missing dependencies: 'latestSuggestionsTimestamp' and 'resetDictionariesHavingQuery'. Either include them or remove the dependency array react-hooks/exhaustive-deps
src/components/Article.js
Line 50:5: React Hook useEffect has missing dependencies: 'isMobile' and 'setQuery'. Either include them or remove the dependency array react-hooks/exhaustive-deps
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
File sizes after gzip:
60.89 kB build/static/js/main.88278f2a.js
744 B build/static/css/main.76883690.css
658 B build/static/css/319.e3dc2fa1.chunk.css
533 B build/static/css/607.7065f111.chunk.css
164 B build/static/js/607.1b6d42e2.chunk.js
163 B build/static/js/319.f9ef5ac5.chunk.js
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
yarn global add serve
serve -s build
Find out more about deployment here:
https://cra.link/deployment
Done in 15.22s.
(sd) root@lxcSilDict:/home/SilverDict/client# ll
total 512
drwxr-xr-x 6 root root 4096 Oct 11 18:27 ./
drwxr-xr-x 7 root root 4096 Oct 11 18:26 ../
-rw-r--r-- 1 root root 3352 Oct 11 18:26 README.md
drwxr-xr-x 3 root root 4096 Oct 11 18:27 build/
drwxr-xr-x 844 root root 36864 Oct 11 18:27 node_modules/
-rw-r--r-- 1 root root 840 Oct 11 18:26 package.json
drwxr-xr-x 2 root root 4096 Oct 11 18:26 public/
drwxr-xr-x 3 root root 4096 Oct 11 18:26 src/
-rw-r--r-- 1 root root 450978 Oct 11 18:26 yarn.lock
(sd) root@lxcSilDict:/home/SilverDict/client#
It's not a problem with SilverDict, I guess, but my nginx configs instead. If I try to run
curl https://www.eplscz1rvblma3qpwsxvrpo930wah.xyz/api/cache/GrandRobert/GrandRobert.css
on my local machine, I get a 404 error. But if I curl
the CSS directly using the backend API on the server, it is all right:
curl localhost:2628/api/cache/GrandRobert/GrandRobert.css -o-
��.m1 {text-align: justify}
.m2 {text-align: justify;padding-left: 4%}
.m3 {text-align: justify;padding-left: 8%}
.m4 {text-align: justify;padding-left: 12%}
.m6 {color: gray}
.m8 {text-align: center;padding-right: 20%}
Additionally, if I look up some words on my local machine using the remote API, it also works well:
curl -I https://www.eplscz1rvblma3qpwsxvrpo930wah.xyz/api/lookup/GrandRobert/polonais
HTTP/2 200
date: Thu, 18 May 2023 11:46:07 GMT
content-type: text/html; charset=utf-8
access-control-allow-origin: *
x-frame-options: DENY
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
strict-transport-security: max-age=31536000
cf-cache-status: DYNAMIC
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=56dTOUG9%2FBS2Xh1OdRwi9lDgmgWxEwncSb41GC9KIWjNlEy0TiRPummyfqDitR0Zd1APn3r%2FN7eRZYqGYNpbqf%2BgCoisDGIb%2BQ%2FeJA8axju90SKIn9iWuzfahkj5ZmHYwP88969BQ3PnYN%2FrilkMPneU6iLJEde%2FD48tErzjnry%2Fdnmj"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 7c93db9aad6804f7-HKG
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
So, it seems that nginx just won't proxy requests under /api/cache/
. What could be the problem?
Moreover, my local nginx (on my laptop) does proxy such requests:
curl localhost:80/api/cache/GrandRobert/GrandRobert.css -o-
��.m1 {text-align: justify}
.m2 {text-align: justify;padding-left: 4%}
.m3 {text-align: justify;padding-left: 8%}
.m4 {text-align: justify;padding-left: 12%}
.m6 {color: gray}
.m8 {text-align: center;padding-right: 20%}
I tried to set up a local server on Debian 12. Steps I took:
as root
apt-get install python3-flask-cors python3-waitress python3-flask
apt-get install yarnpkg
then as user, download the zip file from github go into the unzipped directory.
cd client
yarnpkg install
yarnpkg build
mv dict ../http_server
python3.11 http_server/http_server.py
python3.11 server/server.py
Where did I get wrong in terms of following instructions? How to get it to work?
我使用 GoldenDict-ng 软件查询 nuisance 时 从 SIO双向双解词典v3.3.mdx 获得的 suggestions 比 SiverDict 本地来的全。
➜ curl http://127.0.0.1:2628/api/suggestions/Default%20Group/%nuisance%
{"suggestions":["nuisance","nuisance analysis","nuisance area","nuisance call","nuisanceless","nuisanceless technology","nuisance order","nuisance organism","nuisance or pyblic nuisance","nuisance parameters","nuisance raid","nuisances","nuisance tax","nuisance taxs","nuisancethreshold","nuisance value","nuisancevalue","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"timestamp":1699155984046.5842}
获取的结果只有十七条。(我已经设置 num_suggestions: 100
)
而使用 GoldenDict-ng 软件获取的结果如图,明显是比 SilverDict 多。
我尝试将 preferences.yaml
中的 suggestions_mode: right-side # instantaneous
改为 both-side
。
再次运行 curl http://127.0.0.1:2628/api/suggestions/Default%20Group/%nuisance%
结果出现错误:
INFO:app.dictionaries:Dictionaries loaded.
INFO:waitress:Serving on http://127.0.0.1:2628
ERROR:app:Exception on /api/suggestions/Default Group/%nuisance% [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/site-packages/flask_cors/extension.py", line 176, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/Users/c/Downloads/SilverDict/server/app/api/lookup.py", line 14, in suggestions
suggestions = dicts.suggestions(group_name, key)
File "/Users/c/Downloads/SilverDict/server/app/dictionaries.py", line 130, in suggestions
keys_expanded.extend(db_manager.expand_key(key_simplified))
File "/Users/c/Downloads/SilverDict/server/app/db_manager.py", line 178, in expand_key
rows = cursor.execute(statement, ngrams)
sqlite3.OperationalError: no such table: ngrams
通过 suggestions API 查询 满足
时,获取到 30 个结果:
{'suggestions': ['满足', '满足不了的', '满足不了需求', '满足于', '满足于既得成就', '满足于既得荣誉', '满足于既有成就', '满足人们吃饱', '满足地', '满足大家的需要', '满足对的欲望', '满足感', '满足感官', '满足感官的', '满足或欢乐的', '满足法庭', '满足特定目的', '满足用户', '满足的', '满足的事由', '满足的心情', '满足的状态', '满足的需求', '满足的需要', '满足肉欲的', '满足肉欲的场所', '满足自我', '满足要求', '满足需求', '满足需要', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''], 'timestamp': 1699265280538.1938}
和 GoldenDict 软件的查询结果一致。
然后将 满足肉欲的场所
这个具体的 suggestion 传入 query API,结果显示 not found
:
➜ curl http://127.0.0.1:2628/api/query/Default%20Group/%E6%BB%A1%E8%B6%B3%E8%82%89%E6%AC%B2%E7%9A%84%E5%9C%BA%E6%89%80
<p>Entry 满足肉欲的场所 not found. Suggestions:</p>
<ul>
</ul>%
但是在 GoldenDict 软件点击 满足肉欲的场所
是有结果的,如图:
后来我发现,SilverDict 对于 query TIOv5_单词反查
这个词典中的 suggestion 都是 not found
,但是 GoldenDict 软件都正常。
这种状况如何排查?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.