Giter Site home page Giter Site logo

stardict's People

Contributors

skoro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

amnek0

stardict's Issues

Uncaught RuntimeException: Unknown type "h", maybe it should be registered ?

Hello, thank you for creating this project. If I can get it to work, I'd love to use it.

I downloaded a StarDict for Spanish from https://github.com/BoboTiG/ebook-reader-dict/releases/tag/es

I don't know what version it is ... I don't know StarDict at all, have just started looking at it today.

That stardict contains the following:

dict-data.dict.dz
dict-data.idx
dict-data.ifo
dict-data.syn

I used the example file from the readme, modified slightly:

<?php
use StarDict\StarDict;
require dirname(__FILE__) . '/vendor/autoload.php';

$dict = StarDict::createFromFiles('dict-data.ifo', 'dict-data.idx', 'dict-data.dict.dz');

foreach ($dict->get('gato') as $result) {
    echo $result->getValue();
}

and when I run it, I get the following error:

MacBook-Pro:__stardict_test jeff$ pwd
/Users/jeff/Downloads/__stardict_test
MacBook-Pro:__stardict_test jeff$ php main.php 
PHP Fatal error:  Uncaught RuntimeException: Unknown type "h", maybe it should be registered ? in /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/DictData/TypeSequenceManager.php:42
Stack trace:
#0 /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/StarDict.php(51): StarDict\DictData\TypeSequenceManager->getSequences('h')
#1 /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/StarDict.php(115): StarDict\StarDict->__construct(Object(StarDict\Dict), Object(StarDict\Index\BinaryIndexHandler), Object(StarDict\DictData\FileDZDataReader), Object(StarDict\DictData\TypeSequenceManager))
#2 /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/StarDict.php(98): StarDict\StarDict::create(Object(StarDict\DictFiles))
#3 /Users/jeff/Downloads/__stardict_test/main.php(7): StarDict\StarDict::createFromFiles('dict-data.ifo', 'dict-data.idx', 'dict-data.dict....')
#4 {main}
  thrown in /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/DictData/TypeSequenceManager.php on line 42

Fatal error: Uncaught RuntimeException: Unknown type "h", maybe it should be registered ? in /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/DictData/TypeSequenceManager.php:42
Stack trace:
#0 /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/StarDict.php(51): StarDict\DictData\TypeSequenceManager->getSequences('h')
#1 /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/StarDict.php(115): StarDict\StarDict->__construct(Object(StarDict\Dict), Object(StarDict\Index\BinaryIndexHandler), Object(StarDict\DictData\FileDZDataReader), Object(StarDict\DictData\TypeSequenceManager))
#2 /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/StarDict.php(98): StarDict\StarDict::create(Object(StarDict\DictFiles))
#3 /Users/jeff/Downloads/__stardict_test/main.php(7): StarDict\StarDict::createFromFiles('dict-data.ifo', 'dict-data.idx', 'dict-data.dict....')
#4 {main}
  thrown in /Users/jeff/Downloads/__stardict_test/vendor/skoro/stardict/src/DictData/TypeSequenceManager.php on line 42

Any guidance would be appreciated. Thank you!

Namespace

Convert namespaces to camel format.

Tests

Tests are needed.

Main factory class

// Returns Dict instance by reading a file.
$dict = StarDict::open($filename);
// Returns list of Dicts by reading a directory.
$dicts = StarDict::openDir($dirname);

Please help to use Stardict in find.dhamma.gift.

Олексий, здравствуйте. Меня зовут Павел я из Казахстана, делаю проект по буддистским текстам. Https://find.dhamma.gift/ к сожалению я не разработчик и очень трудно и болезненно идёт процесс.

Я уже скачал и настроил ваш пакет stardict

.../htdocs/dpdd $ composer show skoro/stardict
name     : skoro/stardict
descrip. : Provides interface to StarDict dictionaries.
keywords : dictionary, stardict
versions : * 0.1.2
type     : library

Но я не понимаю как запустить запрос. Я создал файл index.php с таким содержанием, dict файлы и папка vendor лежат там же

<?php
use StarDict\StarDict;

require './vendor/autoload.php';

$dict = StarDict::createFromFiles('dict.ifo', 'dict.idx', 'dict.dict.dz');

echo $dict->getDict()->getBookname(); // show dict name.

foreach ($dict->get('adhivacana') as $result) {
    echo $result->getValue();
}
?>

Но такая ошибка

Fatal error: Uncaught RuntimeException: Unknown type "h", maybe it should be registered ? in /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/dpdd/vendor/skoro/stardict/src/DictData/TypeSequenceManager.php:42
Stack trace:
#0 /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/dpdd/vendor/skoro/stardict/src/StarDict.php(51): StarDict\DictData\TypeSequenceManager->getSequences('h')
#1 /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/dpdd/vendor/skoro/stardict/src/StarDict.php(115): StarDict\StarDict->__construct(Object(StarDict\Dict), Object(StarDict\Index\BinaryIndexHandler), Object(StarDict\DictData\FileDZDataReader), Object(StarDict\DictData\TypeSequenceManager))
#2 /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/dpdd/vendor/skoro/stardict/src/StarDict.php(98): StarDict\StarDict::create(Object(StarDict\DictFiles))
#3 /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/dpdd/index.php(7): StarDict\StarDict::createFromFiles('./dict.ifo', './dict.idx', './dict.dict.dz')
#4 {main}
  thrown in /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/dpdd/vendor/skoro/stardict/src/DictData/TypeSequenceManager.php on line 42

Подскажете пожалуйста что можно сделать

Index caching

Index loading is very slow on the first start.
It would be nice cache index after loading and use it instead of reading index again.

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.