Git Product home page Git Product logo

dictconv's Introduction

dictconv: Mac Dictionary Converter

npm npm GitHub last commit GitHub code size in bytes license

Author: Nogeek

Email: [email protected]

TL;DR

dictconv convert <stardict_xxxxx.tar.bz2> -i -v Building would take some time, please be patient.

Background

A Node.js version of DictUnifier. The original repo is no longer maintained, while I really want a converter for the Stardicts.

Require Node.js >= 12 to support ES module.

Installation

yarn global add @ritou11/dictconv or npm i -g @ritou11/dictconv

You'll also need gunzip, tar,cp,mkdir in your system path. They should be installed with MacOSX already.

Usage

dictconv [command]

Commands:
  dictconv raw <stardict> <destPath>        Convert the startdict to xml
                                            dictionary.
  dictconv build <rawPath> [<destPath>]     Build the Mac dictionary from raw
                                            data
  dictconv convert <stardict> [<destPath>]  Convert the startdict to Mac
                                            dictionary.

Options:
  --version   Show version number                                      [boolean]
  -h, --help  Show help                                                [boolean]
dictconv raw <stardict> <destPath>

Convert the startdict to xml dictionary.

Positionals:
  stardict  <stardict> The path to the stardict file.        [string] [required]
  destPath  <destPath> The destination path.                 [string] [required]
dictconv build <rawPath> [<destPath>]

Build the Mac dictionary from raw data

Positionals:
  rawPath  <rawPath> The path to the raw data files.         [string] [required]

Options:
  --version      Show version number                                   [boolean]
  --name, -n     The name of dictionary                                 [string]
  --install, -i  Install the converted dictionary to the system
                                                      [boolean] [default: false]
dictconv convert <stardict> [<destPath>]

Convert the startdict to Mac dictionary.

Positionals:
  stardict  <stardict> The path to the stardict file.        [string] [required]
  destPath  <destPath> The destination path.                            [string]

Options:
  --version      Show version number                                   [boolean]
  --name, -n     The name of dictionary                                 [string]
  --install, -i  Install the converted dictionary to the system
                                                      [boolean] [default: false]

TODOs

  1. duplicated index
  2. stardict 3.0.0 and idxoffsetbits=64 support
  3. res convert
  4. better way to get the unarchived path

License

MIT

dictconv's People

Contributors

dependabot[bot] avatar ritou11 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  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  avatar  avatar

dictconv's Issues

Convert issue - html tags

Hi!
I used stardict-comn_dictd04_slovnyk_en-pl-2.4.2.tar.bz2
dictconv installed on Mac Os Catalina (brew + yarn).
โ•ฐโ”€$ dictconv convert stardict-comn_dictd04_slovnyk_en-pl-2.4.2.tar.bz2 -i -v Tmpdir created at /var/folders/pv/2cp12wnx5pq1vf5nx8jm1pm00000gn/T/dictconv/1589971345574 Unarchived slovnyk_en-pl.dict.dz Loading dictionary... { version: '2.4.2', wordcount: 15420, idxfilesize: 252910, bookname: 'slovnyk_en-pl', date: '2009.01.30', sametypesequence: 'x', description: 'This file was converted from the original database on: Sat Sep 18 20:07:50 2004 The original data is available from: http://www.slovnyk.org/prg/gszotar/index.html This dictionary is licenced under GNU GPL version 2 (http://www.gnu.org/copyleft/gpl.txt) The converting script is in {00-database-script}. Below are scripts for building .index/.dict files. Extract them using the following command: mimencode -ub | gunzip | tar x H4sIAHl5TEEAA+2UW3PTOBTH82p9irPGkLYbW7KTNN1w2R2GUh4YlmHaJ0KDYyuxpracseQm veS7c6S0EGBmZ1+AYUa/GVuW/D8XHx05orNWlHnnR8JixkbDYYcxFo8OD83I4sHAjkiSJINO zOJ41B/1WdxHfXzYH3WA/dCs7miVThuATlbwVtWX/6HjjfoZCf1cHvxBZ0JSVRDyAACv4EWq +RgSxgaU/UXZCOLhOOmP2RACKyFYr+ksVfxwAHv7NwSQLNXw5Mnxvy/J1EAIY2Ge6tTIQpU1 Yqmt7jkv6xWkDYftooJ53YDtQCEXEAmZ8zWNcpFpmIuSq8iaHa91k+KSLngFrTJSfETbEt2Z WVZXVSrzsVVXouIyq3MOYTuDW1i08los8cFs9JoQk6YVmnlWgB/84xvZVrRjPSMbQkyCAoSE g6jV86MoU5fR7Dp5DHlNPJOjTCv+9CPPihoCgQ4Uz6Gr6MTIwyOjpbT7kXjmo6a74nvjLzbT 9+fhhwNKF49B0ZBOjR3xrNp/29QZV/bbv1gGn536ED97lKD6hnh3FhNyWggFRiJqmTZXgLNS ZPh5PCctlrqBkzdncPL2NVxic6MIEtgrtF6OKV2tVtFCtlHdLGhWL69KPtd0sSwjvdb7BF1z rLpEO21S2m6nCYCVuvl+9zcR8TE5b3ZtWsUPBFYcp+nqAro4mqQ9ka/hKVSpzoq9gPWAnvvv z/0Pfo/u29dz2EPJvtV6xQpQrNqZ0o1VJz149/r4zcnpKwihby28nM+/Ft0r/oTYKja8VHzr 8Pvo0cFd5G9Cm9hfeY13Q28d/4/Yu8E9vhYaku2yTcwUy1s2Quo5+PZQTeREPlQTCWDufg+K VQ8wCgo3Xbi9Besj+NtY7hxRP2A+8Tam3KYT5pWGMCzrLC05NO303Vl0dvoyPIIwG+KLldBF 3eqw4Klpjwn6Clvo7vSEKutLeXVh+2KJ10Jd1xiO2qMbFboqu1szhaFvPvfnxv9mav83AE2F 6/f97JO8lpz86n+iw+FwOBwOh8PhcDgcDofD4XA4HA6Hw+FwOBwOx+/EJywBdIcAKAAA Source url: http://www.slovnyk.org/prg/gszotar/index.html' } converting [====================] 100% 0.0s Saving... Copy assets... Converted raw file path: /var/folders/pv/2cp12wnx5pq1vf5nx8jm1pm00000gn/T/dictconv/raw/mac-slovnyk_en-pl Start building... builder - Building mac-slovnyk_en-pl.dictionary. builder - Checking source. builder - Cleaning objects directory. builder - Preparing dictionary template. builder - Preprocessing dictionary sources. builder - Extracting index data. builder - Preparing dictionary bundle. builder - Adding body data. builder - Preparing index data. builder - Building key_text index. builder - Building reference index. builder - Fixing dictionary property. builder - Copying CSS. builder - Finished building /var/folders/pv/2cp12wnx5pq1vf5nx8jm1pm00000gn/T/dictconv/build/mac-slovnyk_en-pl.dictionary. Built /var/folders/pv/2cp12wnx5pq1vf5nx8jm1pm00000gn/T/dictconv/build/mac-slovnyk_en-pl.dictionary Installed to ~/Library/Dictionaries/

After convertion, I have html tags not supported by App Dict:
image

Could you take a look on that case?
thanks!

It delete my file

I execute it on the ~/Downloads/ directory:

cd Downloads
dictconv convert stardict-langdao-ec-gb-2.4.2.tar.bz2 ./

it delete all my files under the Downloads directory

The "xxx.dictionary" folder isn't created on Apple Silicon

At least that's the use case I have. This works on my Intel Mac (with so-so results as far as the final dictionary formatting, which I've never gotten to work properly with newlines and formatting), but on the M1 Mac, the scripts says identically that it created the ".dictionary" folder in the end, but the dictionary folder is not actually created. Using the --install flag throws an error saying that it couldn't find the .dictionary folder.

Slow xdxf converter

Now the xslt-ts used to convert xdxf is too slow... about 100ms per entry. In Python, lxml is 20 times faster than this.
Anyone with a xdxf dictionary should consider pyglossary. Though it is a bit complicated, the outcome is better than this repo.
Improvement scheduled in the future. Perhaps when a better xslt processer comes out for Node.js. Or just write some Python scripts for pyglossary.

It erases whole output folder

As the topic, it will erase the output folder.

I think its a big issue

Operations:

cd ~/Downloads

dictconv convert ./$name . 

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.