7 0
Contact Author Sign in to rate

Create Sentence Cards from Books (WIP)

3.04MB. Updated 2020-10-13. Only supports Anki 2.1.x.
The author has shared 35 other item(s).

Description

The add-on will allow to import e-books to Anki (epub, mobi or txt) and split text by sentences, i.e. something like - http://textanalysisonline.com/nltk-sentence-segmentation - or maybe - https://www.tm-town.com/blog/is-segmentation-solved-problem - but it seems to remove some quotation marks from the text. SENTENCE CARDS - http://www.antimoon.com/how/usingsm-makeitems-sentence.htm - https://massimmersionapproach.com/table-of-contents/stage-1/jp-quickstart-guide/#sentence-cards - https://www.animecards.site/#h.p_Dt2VLtzKUiuy Or some variant of cloze sentences with a picture added either manually or automatically with the add-on - https://ankiweb.net/shared/info/561924305 - https://blog.fluent-forever.com/new-word-flashcards/ INSTALLATION 1. After installing the add-on from AnkiWeb and restarting Anki, open the Debug Console in Anki - https://docs.ankiweb.net/#/misc?id=debug-console 2. Follow the instructions in the manual to execute the following code and install Punkt Sentence Tokenizer. import nltk nltk.download('punkt') 3. The add-on should work now. HOW TO USE Open Tools - "Create Sentence Cards" and select a .txt file. - The Basic note type will be used to create new notes. - The filename will be the name of the deck. ADDITIONAL INFORMATION This is the second add-on in the series of add-ons to import text with audio to Anki. 1. YouAlign/TMX Importer - https://ankiweb.net/shared/info/536046234 2. Create Sentence Cards from Books 3. (WIP) Convert AudioBooks to Anki - https://ankiweb.net/shared/info/1885548963 - Google Translate - https://ankiweb.net/shared/info/1536291224 CREDITS The add-on uses NLTK to split text by sentences. UPDATE HISTORY 2020-10-13 Simple text file import (v0.0.1) It's been tested on Windows, but should work on Mac and Linux. The text file is supposed to be in UTF-8 encoding. Nickolay <kelciour@gmail.com>

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

1200382751

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1628647044
This would be crazy useful if I could get it working. Downloaded NLTK and NLTK data and tried the punkt quick fix but it didn't work because punkt is fully updated. Any ideas on a fix, author?

Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-08-10 16:46:39

Caught exception:
Traceback (most recent call last):
File "C:\Users\drewo\AppData\Roaming\Anki2\addons21\1200382751\__init__.py", line 36, in main
deck['mid'] = m['id']
TypeError: 'NoneType' object is not subscriptable
on 1625612804
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.1 Qt 5.12.6 PyQt 5.12.3
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-07-06 19:33:52

Caught exception:
Traceback (most recent call last):
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1200382751\__init__.py", line 28, in main
sents = nltk.sent_tokenize(p)
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1200382751\vendor\nltk\tokenize\__init__.py", line 106, in sent_tokenize
tokenizer = load("tokenizers/punkt/{0}.pickle".format(language))
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1200382751\vendor\nltk\data.py", line 752, in load
opened_resource = _open(resource_url)
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1200382751\vendor\nltk\data.py", line 877, in _open
return find(path_, path + [""]).open()
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1200382751\vendor\nltk\data.py", line 585, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:

>>> import nltk
>>> nltk.download('punkt')

For more information see: https://www.nltk.org/data.html

Attempted to load tokenizers/punkt/english.pickle

Searched in:
- 'C:\\Users\\Mohammad/nltk_data'
- 'C:\\Program Files\\Anki\\nltk_data'
- 'C:\\Program Files\\Anki\\share\\nltk_data'
- 'C:\\Program Files\\Anki\\lib\\nltk_data'
- 'C:\\Users\\Mohammad\\AppData\\Roaming\\nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
- ''
**********************************************************************
Comment from author
Try a quick fix. Maybe it'll work.

1. Open the Debug Console in Anki - https://docs.ankiweb.net/misc.html#debug-console
2. Follow the instructions in the manual to execute the following code.

import nltk
nltk.download('punkt')

3. The add-on should work now.
on 1614990033
Amazing addon
on 1605614489
In linux this error ocurs:

Informação de Debug:
Anki 2.1.26 (70784154) Python 3.8.1 Qt 5.14.1 PyQt 5.14.1
Platform: Linux
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-11-16 06:31:23
Extensões possivelmente envolvidas: ⁨Create Sentence Cards from Books WIP⁩

Caught exception:
Traceback (most recent call last):
File "/home/maquiavelho/.local/share/Anki2/addons21/1200382751/__init__.py", line 28, in main
sents = nltk.sent_tokenize(p)
File "/home/maquiavelho/.local/share/Anki2/addons21/1200382751/vendor/nltk/tokenize/__init__.py", line 106, in sent_tokenize
tokenizer = load("tokenizers/punkt/{0}.pickle".format(language))
File "/home/maquiavelho/.local/share/Anki2/addons21/1200382751/vendor/nltk/data.py", line 752, in load
opened_resource = _open(resource_url)
File "/home/maquiavelho/.local/share/Anki2/addons21/1200382751/vendor/nltk/data.py", line 877, in _open
return find(path_, path + [""]).open()
File "/home/maquiavelho/.local/share/Anki2/addons21/1200382751/vendor/nltk/data.py", line 585, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:

>>> import nltk
>>> nltk.download('punkt')

For more information see: https://www.nltk.org/data.html

Attempted to load tokenizers/punkt/PY3/english.pickle

Searched in:
- '/home/maquiavelho/nltk_data'
- '/home/maquiavelho/Documents/Vinicius/Programas/anki-2.1.26-linux-amd64/bin/nltk_data'
- '/home/maquiavelho/Documents/Vinicius/Programas/anki-2.1.26-linux-amd64/bin/share/nltk_data'
- '/home/maquiavelho/Documents/Vinicius/Programas/anki-2.1.26-linux-amd64/bin/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'

obs- I solved this way:

python3 -m nltk.downloader all
Comment from author before post was edited
Thank you. I thought it'll be already installed. And it appears that you might be the first person who downloaded the add-on in about a month, since it was uploaded on AnkiWeb.

I have no time and no much interest to update the add-on at the moment, but try a quick fix. I think it'll work.

1. Open the Debug Console in Anki - https://docs.ankiweb.net/#/misc?id=debug-console
2. Follow the instructions and execute the following code.

import nltk
nltk.download('punkt')

3. The add-on should work now.
on 1594902436
seems to be very useful for my purpose
on 1591122471
great idea
on 1591093928
It is a good idea, thanks!