skoro / stardict Goto Github PK
View Code? Open in Web Editor NEWPHP interface to StarDict dictionaries
PHP interface to StarDict dictionaries
Move exceptions for its namespace.
Олексий, здравствуйте. Меня зовут Павел я из Казахстана, делаю проект по буддистским текстам. 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
Подскажете пожалуйста что можно сделать
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!
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.
xdxf format
Description is in the docs/
Tests are needed.
add a license.
MIT ?
There is no checking when the offset is missing in dictionary index and it gives the below error:
#11 (comment)
Convert namespaces to camel format.
// Returns Dict instance by reading a file.
$dict = StarDict::open($filename);
// Returns list of Dicts by reading a directory.
$dicts = StarDict::openDir($dirname);
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.