GithubHelp home page GithubHelp logo

lig / pystardict Goto Github PK

View Code? Open in Web Editor NEW
101.0 7.0 30.0 829 KB

Library for manipulating StarDict dictionaries from within Python

License: GNU General Public License v3.0

Python 100.00%
python stardict dictionary

pystardict's Introduction

pystardict Build Status

Home page

https://github.com/lig/pystardict

Authors

Serge Matveenko [email protected] and contributors: https://github.com/lig/pystardict/graphs/contributors.

Installation

pip install pystardict

How to use

For working example look into examples directory at the demo.py file. Examples are installed in the /local/prefix/share/pystardict directory, where /local/prefix is your installation prefix.

How to contribute

Fill free to report any bugs or send pull requests on Github: https://github.com/lig/pystardict.

Respect PEP8.

pystardict's People

Contributors

lig avatar sharmi avatar vvasuki avatar wyh avatar yltsrc avatar zhang-z 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  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  avatar  avatar

pystardict's Issues

Exception: ifo has invalid format

Get error when trying to run the following code on Windows 10 and Python3.11:

import os
from pystardict import Dictionary

dict1 = Dictionary(os.path.join('./dict/quick_russian-english'))

can not run demo.py file

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Library doesn't support multiple definitions

Some of the dictionaries files out there can have several meanings for certain word. In current implementation in such case all the other meanings will be lost, as the word is used as a dict key. For example there is a dictionary called 'LegalThesaurus', which can be downloaded form stardict project webpage, which have two different definition for word 'moratorium'.

Attribute 'message' does not exist in IOErrors in Python 3.5

I encountered such an exception. It said it cannot find a *.dict file while actually a *.dict.dz is there.

>>> d = Dictionary('DrEye-jc')
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/pystardict.py", line 647, in open_file
    return open(regular, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'DrEye-jc.dict'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/pystardict.py", line 371, in __init__
    self._file = open_file(dict_filename, dict_filename_dz)
  File "/usr/lib/python3.5/site-packages/pystardict.py", line 649, in open_file
    warn(e.message)
AttributeError: 'FileNotFoundError' object has no attribute 'message'

I then read the code and found it may be the problem of open_file function, where statements like warn(e.message) exists. Some tests I did indicated that expressions like IOError("abc").message work in Python 2.x but 3.x. So there may need some conditional tests before warnings to ensure the compatibility.

Thank you for your great work and hope for a fix.

python 3 is not supported ?

File "/home/ana/data2/iz3/izhuomi_engines/libs/pystardict.py", line 405, in init
self.idx = _StarDictIdx(dict_prefix=filename_prefix, container=self)
File "/home/ana/data2/iz3/izhuomi_engines/libs/pystardict.py", line 159, in init
matched_records = re.findall(record_pattern, self._file)
File "/home/ana/data1/anaconda3/envs/pds/lib/python3.9/re.py", line 241, in findall
return _compile(pattern, flags).findall(string)
TypeError: cannot use a string pattern on a bytes-like object

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.