Skip to content

Commit

Permalink
Update Readme with new gui
Browse files Browse the repository at this point in the history
  • Loading branch information
btrkeks committed Aug 25, 2024
1 parent 24e134e commit 77c569f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 78 deletions.
53 changes: 15 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,15 @@ https://github.com/GenjiFujimoto/dictpopup/assets/50422430/353e5573-e728-419a-a2

https://github.com/Ajatt-Tools/dictpopup/assets/50422430/a0a631eb-85dd-4644-9001-10d2e1076ed4

## Current state

This is still very much a work in progress.
**It only works on the X window manager** right now (i.e. Linux with X11) and the parser for the Yomichan dictionaries
isn't fully implemented yet (for dictionaries with structured content).
See `TODO.txt` for more.

## List of features

* Deinflect
* Kanjify e.g. お前 -> 御前
* Yomichan-style lookup, i.e. decrease length of lookup until there is a match
* Sort dictionary entries by frequency (requires a frequency dictionary. I recommend CC100)
* Fall back to a hiragana conversion (for words written half in kanji / half in hiragana, e.g: かけ布団, 思いつく)
* Play a pronunciation on lookup / button press (requires files see [Pronunciation](#pronunciation))
* Add word with selected definition to Anki
* Indicator showing if a word already exists in your Anki deck / collection. Orange if existing cards are suspended.
Anki browser search on press.
* Sort dictionary entries by frequency (Requires a frequency dictionary. I recommend CC100)
* Fall back to a hiragana conversion (For words written half in kanji / half in hiragana, e.g: かけ布団, 思いつく)
* Play a pronunciations (requires files see [Pronunciation](#pronunciation))
* Add the word to Anki using either the visible definition, the mouse selection or clipboard contents
* Indicator showing if a word already exists in your Anki deck / collection.
* Allow adding the window title to some Anki field (If you are adding from a book, this will e.g. most probably contain
the book title)
* Fast and memory efficient
Expand Down Expand Up @@ -56,39 +47,29 @@ Then install with:
git clone "https://github.com/Ajatt-Tools/dictpopup.git"
cd dictpopup
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF
sudo cmake --build build --target install -j 2
sudo cmake --build build --target install -j 3
```

### Windows

The manual installation instructions above should also work for Windows under MSYS2, so someone
experienced might get it to run. But note that the default config location is currently hard coded for Linux.
I will provide an installer in the future.
experienced might get it to run.

## Setup

After the program installation you need to create a database where the dictionary entries are read from.
This is done via `dictpopup-create` which creates the database from all Yomichan dictionaries in the current directory.
Without arguments, it stores the database in the default location `~/.local/share/dictpopup` which is also the default
search path.
After the program installation you need to first create an index where the dictionary entries are read from.
For this, open `dictpopup-config` (or `dictpopup` and then menu button > settings), then under 'Add dictionaries' in the
'General' tab, choose the folder that contains all of your Yomichan dictionaries and click 'Generate Index'.

You can also include a frequency dictionary in there, but only one (it will give an error if you add more, because I
don't think that mixing makes sense).

## Configuration

Copy the example config `config.ini` of the repo to `~/.config/dictpopup/config.ini` and configure it according to your
setup.
The syntax follows the [Desktop Entry Specification](http://freedesktop.org/Standards/desktop-entry-spec).

Be careful to not include trailing spaces after your variables (for now).

## Pronunciation

To enable pronunciation, simply download some pronunciation indices from Ajatt-Tools (such
as [NHK 2016](https://github.com/Ajatt-Tools/nhk_2016_pronunciations_index))
and specify the path to the directory containing the downloaded folders in the config file. The expected folder
structure looks as follows:
and generate an index under 'Add Pronunciation Files' in the 'Pronunciation' tab of the settings window. The expected
folder structure looks as follows:

```
├── ajt_japanese_audio
Expand All @@ -103,9 +84,8 @@ structure looks as follows:
│   │   ├── index.json
```

On the first run it will automatically create an index which might take up some space (up to 200M if you have many
indices like I do).
This will allow for a faster lookup.
By right clicking the pronunciation button, you can open a menu with all the available pronunciations
for the current kanji/reading pair.

## Usage

Expand All @@ -118,15 +98,12 @@ The "+" sign adds the currently shown definition to Anki after prompting you to
If there is text selected in the popup window, it will be used instead as a definition.
Furthermore, by right-clicking the + sign, you can also use the current clipboard content as the definition instead.

The green/red dot indicates whether the word is already present in your Anki collection.
It displays an orange dot if there exist corresponding cards, but which are all suspended.

## Keybindings

- Next entry: <kbd>n</kbd>, <kbd>s</kbd>
- Previous entry: <kbd>p</kbd>, <kbd>a</kbd>
- Create an Anki card: <kbd>Ctrl</kbd>+ <kbd>s</kbd>
- Play audio: <kbd>r</kbd>
- Play audio: <kbd>p</kbd>, <kbd>r</kbd>
- Exit: <kbd>q</kbd>, <kbd>Esc</kbd>

## Contact
Expand Down
61 changes: 21 additions & 40 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
## dictpopup

High priority

- Investigate why デジタル大辞泉 appears twice in dictionary sort order
- Fix update of dictionary sort order not working

- Suspended + new cards indicator?

- Proper error handling for faulty Anki settings

-------------
- Add database version to metadata of database
- Bring back kanjification

- Add more tests

- What happens when you open dictpopup-config and then dictpopup
- What happens if some random folder was selected for pronunciation index?
-> Proper error message

- More tests (esp. for gui components?)
- Proper error handling for faulty Anki settings
- Test what happens if you press some shortcuts in the error window (e.g. 'no database found')

Mid priority
- Close settings window with escape
------------
- Fix trying too many deinflections
- e.g.:
- に -> にる、ぬ、る
- 白ける -> 白い
- やった -> やつ
- Add info of currently processing dictionary in preferences window when generating dictionary index
- Remove duplication of full path in every jppron database entry
- Safe prefix to indices in metadata and concatenate at runtime
- Allow creating dictpopup db from preferences window
- Cache pronfiles per kanji/reading pair
- Settings should work without a database
- Check if sentence is mapped to some field and only prompt for it in that case
- Implement the reading label as a text view to allow for editing -> initiate new search on Enter press
- Group terms by reading, allow for switching between different readings
- Implement a small window to manually enter a search string instead of selecting
- Implement a small window to manually enter a search string instead of selecting ?
- Write a "Yomichan search"-like window application

pron:
- Allow selecting a pronunciation (on right click)
- Allow specifying the order for pronunciations
- Search for audio of inflected selected word (e.g. 下がらない) (optionally)

Low priority
------------
- Kanjify the word in the copied sentence according to the dictionary entry
- (dictpopup_create) Cleanup database data on error (lock.mdb)
- (dictpopup_create) Cleanup database data on error case (lock.mdb)
- Don't show frequency dicts in sort order
- Need some check when looking up a hiragana conversion from mecab to prevent things like 賢人会 -> 県人会
- Need some check when looking up a hiragana conversion from mecab to prevent things like:
- 賢人会 -> 県人会
- 大正門 -> 大誓文
- 家名だ
- Allow canceling context selection with Esc
- Add tags to the Anki card, similiar to mpvacious
- Better list and table formatting
Expand All @@ -59,23 +61,6 @@ Low priority
- Currently hard coded to 60 bytes
- Only important for an auto scan implementation though

## Known problems:
- Can't pronounce 方方[かたがた]
### Misc
- If there is a dictionary entry for 恭しく even though 恭しい is present in the collection, then a red dot will be shown
### Deinflection
- やった gets deinflected to やつ
- This can be fixed by reading in the 4th string of a Yomichan term-bank entry, which is:
"String of space-separated rule identifiers for the definition which is used to validate deinflection.
An empty string should be used for words which aren't inflected."
- に looks broken

Mecab problems:
- 大正門 pulls 大誓文
- 家名だ

freq:
- いじらしい not present in all

Possible ideas:
- Allow adding audio files indexed by filename (for forvo)
Expand All @@ -98,10 +83,6 @@ Possible ideas:
- Make dictionary numbers (①, ②, ...) clickable for adding to Anki
- A (very small) optimization would be to sort the dictSortOrder string and then use binary search or sth in indexof()

To check:
- definflector.c assumes that constant strings given in the code are utf8 encoded. I don't know if this always has to be true (on Windows)



Test results for storing compressed dictionary entries:
- Snappy: 840M -> 734M
Expand Down

0 comments on commit 77c569f

Please sign in to comment.