GithubHelp home page GithubHelp logo

foosoft / yomichan-anki Goto Github PK

View Code? Open in Web Editor NEW
58.0 8.0 12.0 44.69 MB

Plugin for sentence/vocab mining Japanese books in Anki.

Home Page: https://foosoft.net/projects/yomichan-anki

License: Other

Shell 0.30% Python 99.70%
yomichan anki

yomichan-anki's Introduction

Yomichan for Anki

Yomichan for Anki is Anki plugin built to help students of Japanese learn the language by reading native media on their computer. This application's one-click flash card creation feature makes vocabulary mining trivial, allowing you to focus on enjoying your reading.

Note: This project is no longer maintained and has been superseded by the Yomichan browser extension.

Installation

Yomichan for Anki can be downloaded from the Anki shared addon page. This plugin will automatically notify you when updates are available.

Usage

  1. Make sure you are running the latest version of Anki.
  2. Open your vocab deck and note the fields that are used in your deck:
  3. Launch Yomichan from the tools menu inside Anki.
  4. Open the text file you want and you will see its contents in the Yomichan.
  5. To look up words hover your mouse over them while pressing the middle mouse button (usually this is your scroll wheel). You can also press and hold shift instead if you like (or your mouse has no center button).
  6. To set up your Anki deck for Yomichan select Preferences from the Edit menu:
  7. Now you should add markers such as {expression}, {reading}, {reading} and {sentence} to specify how new cards should be created. Card fields will vary depending on your deck model. If you want to be able to use AnkiConnect tick the checkbox labeled Enable AnkiConnect as shown above.
  8. When you look up definitions you will have the option to create Anki cards for them with one click. You will see the icons for performing these actions next to each item. Icons for actions which update your decks won't show up if Anki thinks you can't add a fact with those items. This likely means that they would either be duplicates of existing cards in the deck or that Yomichan hasn't been properly set up for your deck model.

    Here is what the icons mean (in order from left to right):
    • Add term in Kana form even it can be written in Kanji (e.g. べんきょうか).
    • Add term as it appears in the dictionary including Kanji (e.g. 勉強家).
    • Copy the expression, reading and definition for the term to the clipboard.

Keyboard Shortcuts

Yomichan features several keyboard shortcuts for ease of use:

Shortcut Command
Shift Search under cursor
] Move search cursor forwards
[ Move search cursor backwards
Shift + Ctrl + # Add current Kanji at index 0 - 9 to deck
Ctrl + # Add current term at index 0 - 9 to deck
Alt + # Add current term at index 0 - 9 to deck as Hiragana

Importing Vocabulary

Yomichan is capable of importing vocabulary lists from plain text files and the vocabulary deck database the Amazon Kindle automatically generates when you look up words in the built-in dictionary (this file can be found as /system/vocabulary/vocab.db). Note that importing does not create flash cards automatically, but rather outputs the contents of the file to the Vocabulary and Kanji panes so that you can add facts the same way as when reading within Yomichan.

yomichan-anki's People

Contributors

dayjaby avatar foosoft avatar katthjul avatar njlawton 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yomichan-anki's Issues

Looking up and adding new expressions is very slow

Problem

I've used this wonderful plugin on several machines before, but for some reason on my current system it's very slow. Normally the green "Add expression" button show up immediately after hovering over a work and pressing shift, but now it takes up to 20 seconds before the icon appears. Also, adding a new expression is usually instantaneous, but this also takes upwards of 10 seconds now.

Of course I'm not certain that this is a problem with the plugin, Yomichan or Anki itself, but I thought I might as well start here.

Versions

Yomichan: 21.2.28.2
Anki Version ⁨2.1.42 (8eebfe18)⁩ / Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Firefox 87.0 (64-bit)
Mac OS 10.15.7

Add button to change modifier key from Shift to Ctrl-Shift / Cmd-Shift in preferences

When I edit text, I often end up deleting things by accident, because the Shift button selects text passages that I then type over. I've changed the hotkey manually in the past, but it would be convenient if there was a "Use Ctrl-Shift or Cmd-Shift instead of Shift to look up text" button in the options. I wanted to do it myself, but I don't know how to deal with Qt, and I know I will never get around to it now.

Thanks for considering it and for Yomichan, it is the shit.

Yomichan Anki Firefox Error

When I try to connect Yomichan and Anki, it fails. Following all the steps in order did not help and except "Failed to connect" there is also the error of "Yomichan Anki extension and plugin incompatible". Help would be much appreciated.

An error of Yomichan for Anki

It's an add-on for Japanese learner.And it's download code is 934748696(https://ankiweb.net/shared/info/934748696).
I wanted to install this add-on,but something wrong happened.And I can't fix it.
**After i restarted Anki,there was an error:
Traceback (most recent call last):
File "aqt\addons.py", line 41, in loadAddons
File "C:\Users\���ߺ�\Documents\Anki\addons\yomichan.py", line 97, in
instance = YomichanPlugin()
File "C:\Users\���ߺ�\Documents\Anki\addons\yomichan.py", line 38, in init
Yomichan.init(self)
File "C:\Users\���ߺ�\Documents\Anki\addons\yomichan.py", line 30, in init
self.language = japanese.initLanguage()
File "C:\Users\���ߺ�\Documents\Anki\addons\yomi_base\japanese__init__.py", line 29, in initLanguage
dictionary.Dictionary(os.path.join(directory, 'dictionary.db'))
File "C:\Users\���ߺ�\Documents\Anki\addons\yomi_base\japanese\dictionary.py", line 25, in init
self.db = sqlite3.connect(filename)
OperationalError: unable to open database file

Anki connection failure

I have Yomichan installed and set it up to connect with Anki so I could make flashcards from words I look up. I was able to get it to work initially, and a couple times when the connection stopped working I was able to get it working again either by updating Anki or turning off audio playback on Yomichan (something I found googling around). However, the connection has stopped working again and I have run out of ideas on how to fix it.

I'm on a 1-year old Windows 10 computer, running Yomichan on both Firefox and Chrome and having the same problem on both.

Would very much appreciate any suggestions!
anki connect failure

Requirements for Anki 2.1 compatibility

I know this is no longer maintained, but I miss having this add-on in Anki. If you or anyone has an idea of what it takes to port it to Anki 2.1, this would be a good place to share.

Kanji iteration mark

Hey, thanks for your work developing this wonderful addon.

There's a problem when searching for translations of words that contain 々. For example 人々 will return translations only for 人 (にん, ひと, じん etc.) but not ひとびと. However if I search for ひとびと in hiragana it will show the correct translation for 人々.

Also I've noticed that in the latest version the tags like (n) for nouns and (P) for common words have been removed from the translation. I really liked those since knowing if the word is a noun, adverb, adjective etc. helps with the grammar. Also knowing if it is a common word or not helps sometimes decide if to add it to the deck or not. It would be nice to have them back, hope you will reconsider.

Yomichan not working on windows 10

Hello!

Some time ago I installed Windows 10 (instead of windows 7) on my PC, now for the first time I tried to launch yomichan and received the following error while trying to see a word definition:

Traceback (most recent call last):
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 339, in onContentMousePress
self.updateSampleMouseEvent(event)
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 490, in updateSampleMouseEvent
self.updateSampleFromPosition()
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 513, in updateSampleFromPosition
self.updateVocabDefs()
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 581, in updateVocabDefs
**options
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 566, in updateDefs
html = builder(defs, self.ankiIsFactValid)
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader_util.py", line 204, in buildVocabDefs
html += buildVocabDef(definition, i, query)
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader_util.py", line 184, in buildVocabDef
if query('vocab', markupVocabExp(definition)):
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 455, in ankiIsFactValid
fields = reader_util.formatFields(profile['fields'], markup)
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader_util.py", line 89, in formatFields
result[field] = value.format(**markup)
ValueError: unmatched '{' in format

Usability proposals

I just picked this up and thought that these things could make the first uses a bit easier. I'll just drop these as comments:

  • Make the main text box editable (saving to a .txt file first is inconvenient, especially when reading websites or emails).
  • Add "Paste text here or open a .txt file you want to read!" as initial text into the main text box.
  • Add tooltips for the buttons in the Vocabulary/Kanji widgets
  • Display a message on first start to set up the card export in the preferences (this feature is easy to overlook)

Lastly, a digital currency donation address would be appropriate somewhere :)

Thanks!

Suggestion: Link to duplicates

If you are trying to add a note that already exists through Anki's regular Add dialogue, it offers you to show the duplicate note in the browser. Maybe Yomichan could do the same instead of disabling the symbol when a note has already been added? The symbol could be colored red instead.

This would be helpful when adding context or new examples to a term you have already added to your deck from another text. It might cause lag too, though.

Just putting this in here so I don't forget.

AttributeError: 'NoneType' object has no attribute 'split'

Hello again!

I have a new problem:
when I try to see definitions of certain kanji, for example when I put mouse on 刹 in 刹那的 I receive the following error.

Traceback (most recent call last):
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 336, in onContentMousePress
self.updateSampleMouseEvent(event)
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 487, in updateSampleMouseEvent
self.updateSampleFromPosition()
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\reader.py", line 519, in updateSampleFromPosition
self.state.kanjiDefs = self.language.findKanji(contentSampleFlat[:lengthMatched])
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\japanese\translate.py", line 69, in findKanji
match = self.dictionary.findKanji(c)
File "C:\Users\Andrey\Documents\Anki\addons\yomi_base\japanese\dictionary.py", line 87, in findKanji
'kunyomi': kunyomi.split(),
AttributeError: 'NoneType' object has no attribute 'split'

This happens in Desktop version on Windows 10.

Proposals: persistent text box, alternative search hotkey, JP Support

  1. Currently, Yomichan remembers recent files and reopens it, or fills the text box with the default text. With the editable text box, I think it would be good default behavior to store the text box contents in the preferences file and load it on startup, so that it is persistent and user input does not get flushed.

I changed my local copy to work this way and can do a pull request if you like, but I didn't connect it to a checkbox in the preferences because I don't have PyQt installed.

  1. When writing, the Shift key sometimes triggers the updateSampleFromPosition look-up function and selects text that you immediately replace with your typing. I found that it got in the way a lot, so I changed my hotkey to Ctrl+Shift, but others might appreciate to see an option in the preferences pane rather than digging around in the code.

  2. When I generate cards with Yomichan, I always go into the card browser and generate the readings in "kanji [furigana]" format with Japanese Support afterwards. I think the majority of Japanese learners have that plugin installed, and a {JPsupport_reading} option would be useful.

I was thinking to implement that field by using the libraries of the Japanese Support plugin, if it is installed. Would you be interested in a pull request with that function? I might fiddle with it and make it presentable then.

Cheers again :)

"Add term"-icons don't appear when Expression-field is set to %s

As topic says, I'm unable to add any facts when Expression-field is set to %s.
The icons on definitions simply don't appear.

I was able to narrow it down a bit, though I'm not sure if this is the source of the problem or a safe way to fix it.
In reader_util.py file, buildDefinitionHtml-function: adding definition.sentence as last parameter to buildFactMarkupExpression and buildFactMarkupReading -function calls seems to do the trick:

if factQuery:
        if factQuery(buildFactMarkupExpression(definition.expression, definition.reading, definition.glossary, definition.sentence)):
            links += '<a href = "addExpression:{0}"><img src = "://img/img/icon_add_expression.png" align = "right"/></a>'.format(factIndex)
        if factQuery(buildFactMarkupReading(definition.reading, definition.glossary, definition.sentence)):
            links += '<a href = "addReading:{0}"><img src = "://img/img/icon_add_reading.png" align = "right"/></a>'.format(factIndex)

Flashcard creation

Hi !

I'm sorry if this is the wrong place to do so, but I wasn't sure, so here I am. I'm currently having troubles understanding one of the options, and I mean the one "creating flash-cards". It says that it creates it directly on Anki (and the add-on clearly show me that it is created) issue1 , but there is actually nothing created.
issue2 I searched someone having the same problem, but I can't seem to find it, so... yeah. Please, help ;_;

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.