Code Monkey home page Code Monkey logo

sdcv's Introduction

https://github.com/Dushistov/sdcv/workflows/CI/badge.svg https://img.shields.io/badge/license-GPL%202-brightgreen.svg

sdcv

sdcv is a simple, cross-platform, text-based utility for working with dictionaries in StarDict format.

How to compile and install

mkdir /tmp/build-sdcv
cd /tmp/build-sdcv
cmake path/to/source/code/of/sdcv
make

if you enable nls then you should also type

make lang

to install type

make install

you can use “DESTDIR” variable to change installation path

Documentation

See sdcv man page for usage description.

Bugs

To report bugs use https://github.com/Dushistov/sdcv/issues , if it is not possible you can report it via email to dushistov at mail dot ru. Be sure to include the word “sdcv” somewhere in the “Subject:” field.

Notes to developer

make source code release

make package_source

update translation

cd po
xgettext -k_ ../src/*.cpp -o new.pot
msgmerge -U sdcv.pot new.pot
rm new.pot
for i in `ls *.po`; do msgmerge -U $i sdcv.pot; done

sdcv's People

Contributors

258204 avatar alberdi avatar alcah avatar citrin avatar cyphar avatar doozan avatar dushistov avatar ecraven avatar gucong avatar guidocella avatar jellelicht avatar nickeb96 avatar nijel avatar niluje avatar pavelbykov 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdcv's Issues

Problems running t_json

The t_json test fails on Debian:

$ ctest  --output-on-failure -R t_json
Test project /home/nijel/work/debian/sdcv/build
    Start 5: t_json
1/1 Test #5: t_json ...........................***Failed    0.01 sec
/home/nijel/work/debian/sdcv/tests/t_json: 15: [: missing ]
parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 2, column 15


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.01 sec

The following tests FAILED:
	  5 - t_json (Failed)
Errors while running CTest

option for "more newlines" / pretty printing / formatting

Please add an option (you may even prefer it to be the default) to incorporate more newlines into the output for readability. The text on the left (sdcv) is much less readable than the text on the right (gui software) because sdvc condenses the text currently. This isn't a terminal limitation but an opportunity for more formatting.

There are probably many "attributes" here in a listing, I am not sure which of them are candidates for being separated by newlines. That will require a good editorial eye. Certainly we could offset the separate definitions to make it possible to scan the terminal output. Separating the citations by date is variously done and not done in other software (the OED app for instance) both to good effect: when it can be clearly demarcated by colors and textual style it isn't necessary to break the paragraph of citations into separate lines.

Additional horizontal tabs (or spaces) or terminal color or terminal text styles would all be welcome as well.

The first screenshot is of how it compares to the handling of the DICT format, the second with the STARDICT format (in both cases sdvc uses this STARDICT format). In both cases the terminal version is harder to read because of the formatting.

newlines

stardict

popen error under cygwin

After cmake under cygwin 2.881 64bit, when using make, get:
error: libwrapper.cpp:282:52: 'popen' was not declared in this scope
if (pager && (output = popen(pager, "w")) == nullptr){

Any idea how to resolve that?

FR: do more with return values

For example, return exit code 1 when sdcv searchterm found no results or sdcv -l finds nothing

$ sdcv -l
Dictionary's name   Word count
$ sdcv -l>/dev/null && echo "dics" || echo "no dics"
dics
# but I'd expect "no dics"

Custom output format

Do you have any plan for customizable output instead of hard-coding it.
For example, one can have matching word goes after its definition and so on.
If you have a plan to add this feature, I can help you.
Thank you for your awesome project.

port sdcv to windows

It would be nice to have MS Windows port of SDCV
(command line stardict, capable of running as "filter",
e.g. sdcv.exe "apple" > output.txt), or maybe DLL (with
simple interface) will be enought for including
StarDict in other projects.

parse stardict 3.0 dictionaries

Newer dictionaries, formatted for Stardict 3.0, appear completely garbled when read from sdcv. Maybe sdcv could have an option to eliminate all markup, and an option to parse markup as ANSI color codes (which can be displayed by most terminals).

This is partly implemented, need review what not yet implemented.

How to compile this program on Windows?

Hello, Thanks for your job.

Now I want to use this program on Windows7. Is there a compiled .exe that can be used on Windows?
Or Which tool should I use to compile this program?

I am not familiar with cmake. I used msys2 and cmake to compile the program. Error occured.
Can you give some details, please?

Best regards.

add a SDCV_HISTFILE environment variable

It would be nice to have a SDCV_HISTSIZE environment variable to be able to put ~/.sdcv_history in an other file (for example $XDG_DATA_DIR/sdcv/sdcv_history).

master: can not see sdcv output

After merge of #22, particulary 3105823 after some requests sdcv shows nothing, but works ok if SDCV_PAGER unset,
for example sdcv метафорически shows nothing.

ordering of dictionaries

There are a couple of ways to deal with the ordering of dictionaries. For example, get ordering from a configuration file, from command line arguments or alphabetically. Actually they are all fairly easy to implement. Since the core library already have ordering capability, all we need is to construct an ordering list when the program starts.

I have written a patch that get ordering from command line. In particular, the ordering is the same as that of the '-u' arguments. For example when we invoke the program as following:
$ sdcv -u "dict1" -u "dict2" -u "dict3"
the result will be in "dict1" then "dict2" and finally "dict3".

This seems cumbersome, but at least, you can make an alias in your shell like
alias sdcvorder="sdcv -u "dict1" -u "dict2" -u "dict3""
or write a wrapper shell script. Then this is virtually the same as getting the ordering from a configuration file except in one circumstance, that is, you have to specify the ordering of a dictionary in order to look up in it. In other words, you cannot give a partial ordering and leave others in random. However, the advantage is one can change the ordering on every invoke of the program. This is flexible when used in scripts or in emacs. Maybe someone will be able to propose a better way.

Compilation failure on Windows

Hi, I'd like to compile sdcv with mingw-64 on Windows but bumped into following errors:

$ cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" ../sdcv-0.5.2
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CXX_SUPPORTS_CXX11
-- Performing Test CXX_SUPPORTS_CXX11 - Success
-- Found ZLIB: C:/msys64/mingw64/lib/libz.dll.a (found version "1.2.11")
-- Found PkgConfig: C:/msys64/mingw64/bin/pkg-config.exe (found version "0.29.2")
-- Checking for one of the modules 'glib-2.0'
-- Found GLib2: glib-2.0;intl C:/msys64/mingw64/include/glib-2.0;C:/msys64/mingw64/lib/glib-2.0/include;C:/msys64/mingw64/include
-- Looking for include file glib/gregex.h
-- Looking for include file glib/gregex.h - not found
-- REQUIRED_VARS
-- Looking for mmap
-- Looking for mmap - not found
-- Looking for locale.h
-- Looking for locale.h - found
-- Configuring done
-- Generating done
-- Build files have been written to: D:/James/Work/build-sdcv
$ mingw32-make.exe
Scanning dependencies of target sdcv
[ 12%] Building CXX object CMakeFiles/sdcv.dir/src/sdcv.cpp.obj
[ 25%] Building CXX object CMakeFiles/sdcv.dir/src/readline.cpp.obj
[ 37%] Building CXX object CMakeFiles/sdcv.dir/src/libwrapper.cpp.obj
[ 50%] Building CXX object CMakeFiles/sdcv.dir/src/utils.cpp.obj
In file included from C:/msys64/mingw64/include/glib-2.0/glib/gi18n.h:23:0,
                 from D:\James\Work\sdcv-0.5.2\src\utils.cpp:29:
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(int)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6403:50: error: 'libintl_vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int),
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6403:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(unsigned int)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6408:50: error: 'libintl_vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6408:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(long int)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6414:50: error: 'libintl_vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long),
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6414:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(long unsigned int)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6419:50: error: 'libintl_vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6419:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(long long int)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6425:50: error: 'libintl_vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6425:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(long long unsigned int)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6431:50: error: 'libintl_vsnprintf' is not a member of 'std'
   { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6431:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(float)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6440:50: error: 'libintl_vsnprintf' is not a member of 'std'
     return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6440:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(double)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6449:50: error: 'libintl_vsnprintf' is not a member of 'std'
     return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6449:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h: In function 'std::__cxx11::string std::__cxx11::to_string(long double)':
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6458:50: error: 'libintl_vsnprintf' is not a member of 'std'
     return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
                                                  ^
C:/msys64/mingw64/include/c++/7.3.0/bits/basic_string.h:6458:50: note: suggested alternative:
C:/msys64/mingw64/include/libintl.h:379:12: note:   'libintl_vsnprintf'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
mingw32-make[2]: *** [CMakeFiles\sdcv.dir\build.make:105: CMakeFiles/sdcv.dir/src/utils.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:67: CMakeFiles/sdcv.dir/all] Error 2
mingw32-make: *** [Makefile:151: all] Error 2

Any ideas?

new release tag?

It would be great if we could get a new stable release tag here on GitHub for the Homebrew formula. The current formula is building with

"http://svn.code.sf.net/p/sdcv/code/trunk", :revision => "76"
version "0.5-2013-09-10"

I'm updating that to what I believe is equivalent here on GitHub

  url "https://github.com/Dushistov/sdcv.git",
      :revision => "c347ae7da9b7969e00696b18035d9a7d200e43e3"
  version "0.5-2013-09-10"
  revision 1

But it would be much preferred if we could build from a GitHub source archive tarball (automatically generated when you create any tag) or an actual release tarball you post manually. Ideally, the new tag would include your new work, assuming it's ready to be designated stable, but even just a tag of the svn revision 76 equivalent would be preferred to the current situation.

Thanks!

Compiling error 'popen' not declared in this scope

My work need windows. I use cygwin64 as terminal.
Compile sdcv in cygwin64 would failed with 'popen' not declared error.

This is because popen is not standard ISO C++. The problem can be fix with compiling flag CMAKE_CXX_FLAGS="-U__STRICT_ANSI__". I suggest that you can add the option '-U__STRICT_ANSI__' to the file cmake/compiler.cmake:
~$ git diff
`diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index cf94ed3..f8ebd58 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -23,7 +23,7 @@ elseif (MSVC)
elseif (NOT MSVC)
check_cxx_compiler_flag("-std=c++11" CXX_SUPPORTS_CXX11)
if (CXX_SUPPORTS_CXX11)

  • append("-std=c++11" CMAKE_CXX_FLAGS)
  • append("-std=c++11 -U__STRICT_ANSI__" CMAKE_CXX_FLAGS)
    else ()
    message(FATAL_ERROR "sdcv requires C++11 support but the '-std=c++11' flag isn't supported.")
    endif()`

Follows are error details:
~$ git show --oneline
51db56f (HEAD -> master, origin/master, origin/HEAD) Merge pull request #38 from nijel/master
~$ mkdir build; cd build
~$ cmake ..
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
CMake Warning at /usr/share/cmake-3.6.2/Modules/Platform/CYGWIN.cmake:15 (message):
CMake no longer defines WIN32 on Cygwin!
... ...
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/e/yanyg-data/git/sdcv/build
~$ make
Scanning dependencies of target sdcv
[ 12%] Building CXX object CMakeFiles/sdcv.dir/src/sdcv.cpp.o
[ 25%] Building CXX object CMakeFiles/sdcv.dir/src/readline.cpp.o
[ 37%] Building CXX object CMakeFiles/sdcv.dir/src/libwrapper.cpp.o
/cygdrive/e/yanyg-data/git/sdcv/src/libwrapper.cpp: In constructor ‘{anonymous}::sdcv_pager::sdcv_pager(bool)’:
/cygdrive/e/yanyg-data/git/sdcv/src/libwrapper.cpp:299:48: error: ‘popen’ was not declared in this scope
if (pager && (output = popen(pager, "w")) == nullptr) {
^
/cygdrive/e/yanyg-data/git/sdcv/src/libwrapper.cpp: In destructor ‘{anonymous}::sdcv_pager::~sdcv_pager()’:
/cygdrive/e/yanyg-data/git/sdcv/src/libwrapper.cpp:309:26: error: ‘pclose’ was not declared in this scope
pclose(output);
^
make[2]: *** [CMakeFiles/sdcv.dir/build.make:111: CMakeFiles/sdcv.dir/src/libwrapper.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/sdcv.dir/all] Error 2
make: *** [Makefile:150: all] Error 2

Color option does not work

The --color option is not working. It only shows color on the dictionary title, but not on the entries.

screenshot_20190112_122623

(Compare my output with that of another user here: #46)

I'm running latest version of sdcv on Manjaro Linux KDE. I tried other terminal emulators besides Konsole, with the same results.

"nitems == 1 not true"

sdcv-0.5.3 from AUR

removing ~/.cache/sdcv/ and running sdcv show save to cache lines until:

Internal error: nitems == 1 not true at /build/sdcv/src/sdcv-0.5.3/src/stardict_lib.cpp: 544

Which is very much like this 2017 issue, for which the workaround on that page is still good, so I'm guessing the problem remains to lie with load_cache

Running sdcv as root, or another user on the same machine the problem does not recur.
Also, saving to cache only happens for regular users and not root, is that normal?

New release?

I've noticed that as of now the current branch supports the XDG specification apart from some other commits (albeit not many).
Wouldn't it be okay to do a release so that distributions that don't have -git versions update their packages?

link error on netbsd

~/sdcv-0.5.2/obj $ cmake ..
~/sdcv-0.5.2/obj $ make
[ 12%] Linking CXX executable sdcv
ld: cannot find -lglib-2.0
......
~/sdcv-0.5.2/obj $ pkg-config --libs glib-2.0
-L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lglib-2.0 -lintl

~/sdcv-0.5.2/obj $ ls /usr/pkg/lib | grep -i glib
glib-2.0
libdbus-glib-1.a
libdbus-glib-1.la
libdbus-glib-1.so
libdbus-glib-1.so.2
libdbus-glib-1.so.2.3.3
libglib-2.0.a
libglib-2.0.la
libglib-2.0.so
libglib-2.0.so.0
libglib-2.0.so.0.5200.3

Regards!

use .syn files

SDCV does not use the synonyms information that is in dictionaries that come with a .syn file. In some languages synonyms are very important as a word can have many variations depending on gender, tense, etc.

Can you add the effect of color highlighting dictionary titles?

Sometimes, there are too many dictionaries displayed for the same word, and it is too difficult to distinguish which content belongs to which dictionary.

--> Even in this way.

Or, at least in two colors can distinguish passages from different dictionaries.

XDG Base Directory Support

Could support of XDG Base Directories be considered? Although there are workarounds (e.g. #41), it would be nice to be freedesktop.org compliant and use XDG base directories by default. So .config/stardict or .local/share/stardict instead of .stardict, which pollutes the home directory.

KOReader patches

See koreader/sdcv#4 for more information

commit 4900907003c1d2aa0ac6c847c1f6c1db435ea6f1
Author: chrox [email protected]
Date: Thu Mar 12 16:46:21 2015 +0800

Print "save to cache" and "Nothing similar to" messages to stderr so that it won't mess up JSON data

commit b1f5bf15f3219c7b9a8dcccc1f31c763487b4bf5
Author: chrox [email protected]
Date: Wed Oct 29 16:23:00 2014 +0800

Add suppport for HTML and Wikimedia dictionary data

commit fbf9f111e60c22d3b0fccbf10fae4e453a34ca26
Author: chrox [email protected]
Date: Tue Apr 30 17:52:10 2013 +0800
koreader.zip

Add --json-output option

commit 8862e5fc933f7391b300e15f15790678481270de
Author: chrox [email protected]
Date: Tue Apr 30 17:50:22 2013 +0800

Add cJSON library

koreader.zip

Internal error

Hello Evgeniy

Today I reinstalled my Bodhi Linux OS and previously working sdcv somehow stopped working. I have no idea what is wrong. Look at the attached link with picture:
https://i.imgur.com/r3q0Fkq.jpg

Dictionaries are at the right place but sdcv is not possible to run. Any ideas?
Thanx
Stefan

sdcv_ordering example

I have been look for examples for quite some time now and can not find one. Does anyone have an example I could use so I know what this files needs to look like and include?
Thanks.

Crashing dictionary

Apologies for the non-descriptive title but I wasn't able to get an angle on it with a quick glance. It's the one from here: https://www.mobileread.com/forums/showthread.php?p=3900775

Without a newline at the end of the ifo file (which seems a bit suspicious):

$ sdcv test
Internal error: basic_string::_M_replace

With a newline added to the end of the file:

$ sdcv test
save to cache /home/frans/.stardict/dic/stardict-en-wordnet-3.1/dictd_wwwdictorg_wn.idx
Segmentation fault

Something about memmove.

accept words with '-tion'

Hi, sdcv currently doesn't support passing word with leading dash, not even in quotes. Is there a way to achieve this?

Test failures on big endian

Both fail with:

sdcv: /<<PKGBUILDDIR>>/src/stardict_lib.cpp:542: const gchar* {anonymous}::OffsetIndex::read_first_on_page_key(glong): Assertion `(nitems == 1)' failed.

Problematic code:

sdcv/src/stardict_lib.cpp

Lines 535 to 545 in 925a4bc

inline const gchar *OffsetIndex::read_first_on_page_key(glong page_idx)
{
fseek(idxfile, wordoffset[page_idx], SEEK_SET);
guint32 page_size = wordoffset[page_idx + 1] - wordoffset[page_idx];
const size_t nitems = fread(wordentry_buf,
std::min(sizeof(wordentry_buf), static_cast<size_t>(page_size)),
1, idxfile);
THROW_IF_ERROR(nitems == 1);
//TODO: check returned values, deal with word entry that strlen>255.
return wordentry_buf;
}

mac os x support

There is problem with compilation of sdcv on old mac os x with clang without c++11 support.

Change location of $HOME/.stardict

Is it possible to change the location of $HOME/.stardict to something else like, for example $HOME/.local/.stardict` ?

I tried setting the STARDICT_DATA_DIR, but that did not change the fact that sdcv created the .stardict dir (empty) on every run.

sdcv 0.5.1 build error on 32bit system

sdcv fails to build on FreeBSD i386 with clang 3.8
Error is:

sdcv-0.5.1/src/libwrapper.cpp:325:9: error: use of overloaded operator '[]' is ambiguous (with operand types 'glib::CharStr' (aka 'ResourceWrapper<char, void, g_free>') and 'int')
        if (str[0] == '\0')
            ~~~^~
sdcv-0.5.1/src/utils.hpp:18:14: note: candidate function
    const T& operator[](size_t idx) const {
             ^
sdcv-0.5.1/src/libwrapper.cpp:325:9: note: built-in candidate operator[](struct ResourceWrapper<char, void, &g_free>::Tester *, int)
        if (str[0] == '\0')
               ^
sdcv-0.5.1/src/libwrapper.cpp:325:9: note: built-in candidate operator[](const struct ResourceWrapper<char, void, &g_free>::Tester *, int)
sdcv-0.5.1/src/libwrapper.cpp:325:9: note: built-in candidate operator[](volatile struct ResourceWrapper<char, void, &g_free>::Tester *, int)
sdcv-0.5.1/src/libwrapper.cpp:325:9: note: built-in candidate operator[](const volatile struct ResourceWrapper<char, void, &g_free>::Tester *, int)
1 error generated.

"Cannot convert __ to utf8" error when searching Chinese characters

Whenever I search for a Chinese phrase (in this case, say, 愉快), I get the following error:

Can not convert 愉快 to utf8.
轉換輸入資料時遇到不正確的位元組組合

This is the output of locale:

LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

If I export LANG=en_US.UTF-8, the error message reads out in English:

Can not convert 愉快 to utf8.
Invalid byte sequence in conversion input

FWIW, I'm on Mac OS X 10.11 El Capitan in the native Terminal.app terminal emulator.

Does not display all of the dictionary's results

Seems like the program does not return all values from the dictionary.

For example, there are multiple values for "rock" (noun, verb, etc) in the Webster's 1913 dictionary, but only the first result is displayed.

I tried with 2 other dictionaries as well, and the problem persisted.

Problem with output from stardict files with multiple language definitions

Hello, today i compiled your program (which i love by the way, although i'm a new user) from trunk and also from openSUSE Build Service.

When using a stardict dictionary that has definitions in more than language (i.e. a wiktionary export (wikt-en-ALL-2015-02-01.7z from http://www.dictinfo.com/ is an example)) sdcv only outputs the last language definition, rather than all.

output from sdcv:

-->wikt-en-ALL-2015-02-01
-->pertinent

Latin vb.
(inflection of pertineō 3 p pres actv indc Latin)
output from stardict:
<--- wikt-en-ALL-2015-02-01 --->
pertinent
a.
important with regard to (a subject or matter); relevant
--
French a.
(l en pertinent); relevant
-- 
Latin vb.
(inflection of pertineō 3 p pres actv indc Latin)

Use sdcv to export the list of all the words in a dictionary for use by aspell.

On Ubuntu 20.04, I've installed the latest git master version of sdcv and have added some dictionaries:

werner@X10DAi:~$ sdcv --version
Console version of Stardict, version 0.5.3
werner@X10DAi:~$ sdcv -l
Dictionary's name   Word count
懒虫简明英汉词典    452185
Webster's Third New International Dictionary, Unabridged (En-En)    296190

Now I want to export all the words in a dictionary, say, "Webster's Third New International Dictionary, Unabridged (En-En)" for use by aspell.

Any hints for doing this with sdcv?

Regards,
HY

sdcv as filter

Hi,

is it possible to use sdcv as filter? I am creating new dictionary for stardict and I need something like this:

cat list_of_words | sdcv -n -u new_dict >unknown_word.txt

list_of_words = file with one word per line...

Of course there has to be some option for sdcv to shown only unknown words (no exact match)...

Right now about mentioned command just returns:
"There are no words/phrases to translate."

Autocomplete words

Hi, I am using sdcv as my daily dictionary software but I found it is hard to discover words with a specific prefix. It would be helpful if you add autocompletion support, so when I type something, it will show a list of words with my input as prefix. You can also make it only available through <Tab>.
For example:

Enter word of phase: dis<tab>
dislike
disappear
dismiss
... etc ...

Thank you very much for your consideration.

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.