Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish StarDict files #480

Merged
merged 2 commits into from
Dec 18, 2020
Merged

Publish StarDict files #480

merged 2 commits into from
Dec 18, 2020

Conversation

BoboTiG
Copy link
Owner

@BoboTiG BoboTiG commented Dec 18, 2020

--convert: Generate dict-LOCALE.df

And not dict-LOCALE-LOCALE.df.

  • Related to Output to other formats #409
  • Tests added/updated.
  • ./check.sh run and eventual issues fixed.
  • Updated CONTRIBUTORS.md, if not already done in the past.

And not dict-LOCALE-LOCALE.df.
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 18, 2020

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.05%.

Quality metrics Before After Change
Complexity 21.22 😞 21.22 😞 0.00
Method Length 65.77 🙂 65.59 🙂 -0.18 👍
Working memory 13.44 😞 13.44 😞 0.00
Quality 52.74% 🙂 52.79% 🙂 0.05% 👍
Other metrics Before After Change
Lines 413 413 0
Changed files Quality Before Quality After Quality Change
tests/test_3_convert.py 60.49% 🙂 60.49% 🙂 0.00%
wikidict/convert.py 51.87% 🙂 51.91% 🙂 0.04% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
wikidict/convert.py KoboFormat.save_html 69 ⛔ 324 ⛔ 20 ⛔ 7.93% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
wikidict/convert.py DFFormat.process 8 ⭐ 134 😞 13 😞 51.64% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/test_3_convert.py test_simple 0 ⭐ 98 🙂 35 ⛔ 53.27% 🙂 Extract out complex expressions
tests/test_3_convert.py test_generate_dict 0 ⭐ 109 🙂 17 ⛔ 57.81% 🙂 Extract out complex expressions
wikidict/convert.py KoboFormat.save 2 ⭐ 185 😞 9 🙂 59.66% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@BoboTiG BoboTiG merged commit a1f2461 into master Dec 18, 2020
@BoboTiG BoboTiG deleted the fix-409-stardict branch December 18, 2020 16:32
- name: Generate dictionary (StarDict)
run: |
pyglossary --read-format Dictfile --write-format Stardict --no-progress-bar --no-color data/${{ matrix.locale }}/dict-${{ matrix.locale }}.df ifo
zip dict-${{ matrix.locale }}.zip ifo.dict.dz ifo.idx ifo.ifo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifo.dict.dz ? really ?
I used

python3 main.py ../ebook-reader-dict/data/fr/dict-fr.df dict-fr.ifo

and I got

dict-fr.dict	dict-fr.idx	dict-fr.ifo	dict-fr.syn

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I got dict.dz and no .syn :)

Copy link
Owner Author

@BoboTiG BoboTiG Dec 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe local results are bad (for whatever reason). But ideally pyglossary generates the final Zip, it would ease things.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do something like:

$ pyglossary --read-format Dictfile --write-format Stardict --no-progress-bar --no-color data/${{ matrix.locale }}/dict-${{ matrix.locale }}.df dict-data.ifo
$ zip dict-${{ matrix.locale }}.zip dict-data.*

But I am not sure of the Zip filenames then. Do you know if names are important or just the file extension maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants