Back

how to use swanki?

#1
Ok, I'm trying to get swanki to work on my anki, but it seems that I can't get it to work. On startup of anki, I keep getting a message, telling me something like that "the module swanki-1.21.py doesn't exist." Reading that I needed to edit the configuration section to describe my decks, I assumed this meant that I needed to open up and edit the file. Since the decks I'm using are a RTK 1-3 deck that I got off the shared decks and the Japanese corePLUS gotten likewise, I opened up the attachment in notepad and deleted the

{"deck":"~/.anki/decks/ko2001.anki","fact":"KO2001","card":"Recognition","field":"Expression","type":"sentence"}

part of the file, since I don't have a ko2001 deck. Then I edited the names of the Kanji deck, replacing

{"deck":"~/.anki/decks/kanji.anki","fact":"kanji","card":"write","field":"kanji","type":"kanji","fallback":"keyword"}

with

{"deck":"~/.anki/Heisig RTK (1-3).anki","fact":"kanji","card":"write","field":"kanji","type":"kanji","fallback":"keyword"}
(I edited out the /decks/ portion because I don't have a separate decks folder in my anki folder.)

And then I did the same with

{"deck":"~/.anki/decks/kore.anki","fact":"kore","card":"vocab-recognition","field":"vocab-furigana","type":"word"},
{"deck":"~/.anki/decks/kore.anki","fact":"kore","card":"sentence-recognition","field":"sentence-expression","type":"sentence"}

replacing them with

{"deck":"~/.anki/Japanese corePLUS.anki","fact":"card":"vocab-recognition","field":"vocab-furigana","type":"word"},
{"deck":"~/.anki/Japanese corePLUS.anki","fact":"card":"sentence-recognition","field":"sentence-expression","type":"sentence"}

Then I tried to implement what cangy told me:
cangy Wrote:you can also keep the English keyword as a select-to-view hint:
Code:
<!--fon--><span style='font-size: larger'>%(swanki-seen-prompt)s</span>
%(swanki-new-prompt)s<!--foff-->
<a style="color: white" href="http://kanji.koohii.com/study/?framenum=%(text:heisig number)s">%(keyword)s</a>
in this thread here, by copying and pasting the

<a style="color: white" href="http://kanji.koohii.com/study/?framenum=%(text:heisig number)s">%(keyword)s</a>

part and pasting it after the

prompt={"seen":"swanki-seen-prompt","new":"swanki-new-prompt"}

part of the file. Then I saved it and moved into the plugin folder. These are the exact and only changes I make to the file.

I'm not really very familiar with python or programming in general, so I want to ask what I should do to configure it right? I really want to be able to use swanki.
Reply
#2
Looks a little more complicated than a general SRS question. Consider trying over at the Anki Forums?
http://groups.google.com/group/ankisrs/topics
Reply
#3
I don't know. Since swanki was introduced on these forums and the guy who developed it is a member here, I thought I could get better feedback here since this isn't a problem having to do with anki itself but rather how I'm configuring this specific plugin. My understanding is that the anki forums are for mainly problems with the application itself.

Actually, I would just be happy with a little more specific instructions on how to use the swanki plugin. I just put what I did for some troubleshooting background if needed.
Edited: 2010-07-29, 11:57 pm
Reply
May 16 - 30 : Pretty Big Deal: Save 31% on all Premium Subscriptions! - Sign up here
JapanesePod101
#4
He's also on the anki google group, naturally enough. Forum rules are that technical questions should go there, and trust me that's exactly what he'll say if/when he sees this thread.

(Good luck on solving your problem; sorry, I don't know the answer.)
Reply
#5
ok, thank you.
Reply
#6
mafried Wrote:He's also on the anki google group, naturally enough. Forum rules are that technical questions should go there, and trust me that's exactly what he'll say if/when he sees this thread.
I announced swanki on the revtk rather than the anki forums cos I imagined there'd be more kanji people here using anki than anki people there doing kanji, so I'd be fine with a "so how do you use this thing anyway?" post to the original thread

turns out damien's more likely to complain than fabrice anyway...
Reply
#7
joha87 Wrote:Ok, I'm trying to get swanki to work on my anki, but it seems that I can't get it to work.
I'll be away for a couple of weeks so sorry I won't be able to help more till then, but I can give a few extra tips now

the html stuff from the other thread goes into your anki card template, not in the config

the config is a python list of dictionaries (if you want to check the syntax), so be careful with the commas, quotes, colons and braces

the dictionary keys (left of the colon) are as follows, so you'll need to change the terms (right of the colon) to match your deck (pretty much as you've been doing):

deck: deck file name
fact: model name
card: card template name
type: card type: "kanji", "word" or "sentence".
field: field name (for "type":"word" it should be a reading field for the prompts to work properly)
fallback: field name for kanji fallback prompt (only for "type":"kanji")
Edited: 2010-07-30, 6:45 am
Reply
#8
Sorry cangy, I thought he meant damien.
Reply
#9
Ok, thanks for the reply. I'm not sure if you'll catch this question but I'm not sure about what all that I have to download to run the script. In addition to python, do I need to install all the dependencies listed in the readme in the ankiqt source tarbell on github or on here, like pyqt and numpy? Do I have to get libanki through Git and do I basically need a developmental version of Anki just to run a script like swanki? And am I supposed to install a separate program for the interpreter?

I read that all I needed to run a python script was python, but that article wasn't referring specifically to the swanki script though.
Reply
#10
Okay, I'm bumping this thread, I don't know if cangy has come back or not yet to check on it, but I thought I might as well ask about some problems I'm having with running the swanki python script.

From what I read on the anki-wiki, you don't need the whole developmental anki setup for plugin development, so I'm guessing this means I don't need developmental anki just to run a plugin. Which is good since I can't get it to work. But I managed to get libanki and all the dependencies listed so I assume this means that this area is good. But I'm not totally sure.

Next, I edited the configure section with Vim like this:

config=[
{"deck":"~/.anki/decks/Heisigs Remember the Kanji (RTK) 13.anki","fact":"Heisig","card":"Production","field":"Kanji","type":"kanji","fallback":"keyword"},
{"deck":"~/.anki/decks/Japanese corePLUS.anki","fact":"Japanese","card":"Vocabulary","field":"Reading","type":"word"},
]

Making sure to keep the everything intact (not messing with the tabs) and editing it according to Cangy's advice earlier with exact casing.
I then added the swanki-seen-prompt, swanki-new-prompt, swanki-seen-vocab, and swanki-new-vocab fields to my Kanji deck, but I'm not sure where to put them in the card template. I put the seen and new prompt fields into the front like this:
<!--fon--><span style='font-size: larger'>%(swanki-seen-prompt)s</span>
%(swanki-new-prompt)s<!--foff-->
But I'm not sure where to put the vocab fields. I just stuck them on the back but I can't get that to work, so I'm wondering what I'm supposed to do.

And if cangey doesn't see this, is there anyone else who uses swanki? I decided to try to use swanki because I saw it recommended, so I assumed so.

Also, something that's bothering me: on my thread on anki google groups, Damien mentioned something about the dependencies not being accessible outside of the application on Windows. I have Windows XP, so does this mean I would need to use another way to run the script than just double-clicking it?
Edited: 2010-08-17, 9:27 am
Reply
#11
joha87 Wrote:Okay, I'm bumping this thread, I don't know if cangy has come back or not yet to check on it, but I thought I might as well ask about some problems I'm having with running the swanki python script.
back now, took a bit longer than expected due to an unscheduled tropical acute febrile disease...

to run swanki (or other libanki apps such as franki, the overwrite fields plugin replacement) on windows you need to install anki (to get libanki and dependencies) and install python (because the one that comes with anki is packaged into the anki executable and can't be used). see http://ichi2.net/anki/wiki/ContribFugounashi#readme for details. you could make a batch file if you want something you can click on

your config looks good, except for maybe a trailing comma before the close bracket

the prompts go on the front as you've done, and the corresponding vocab fields go on the back, just for information (they're the same as the prompts but without the kanji being obscured)
Edited: 2010-09-07, 10:12 pm
Reply
#12
This would be one of the coolest plugins ... if it were an actual plugin...
Reply
#13
It looks like you need to tell python about your module. Playing around with the data paths isn't going to help there; you need to make sure the module is in your system path.

If I have python right, you can either fix the PATH entry in your environment (or the Unix equivalent), or execute sys.path.append as part of your python program.
Reply
#14
hereticalrants Wrote:This would be one of the coolest plugins ... if it were an actual plugin...
It would be nice... But if not, before I start trying to set it up, I was wondering - what are the improvements over 'overwrite fields' ? Overwrite fields works well, mostly, but it is very slow on a large deck.
Edited: 2010-08-29, 9:22 pm
Reply
#15
hereticalrants Wrote:This would be one of the coolest plugins ... if it were an actual plugin...
would it make much difference? if you think the script is going to be useful give it a try

rachels Wrote:what are the improvements over 'overwrite fields' ? Overwrite fields works well, mostly, but it is very slow on a large deck.
for franki the functionality is the same as the overwrite fields plugin (at the moment, I might add support for tags and a keyless dump/load feature later).

the main differences are that the plugin is no longer supported or maintained, you have to edit the source to configure it, there's no error checking, it requires a few extra steps to use, and it's a plugin. whereas franki is being maintained, you don't have to edit anything, has useful error and progress messages, is a stand-alone script, and has a CLI
Reply