Git Product home page Git Product logo

anki-sync's Introduction

Anki-Sync

Anki-Sync enables bulk-modifications and creation of flashcards. Its capabilities include modifying, extending, and transferring flashcards using external providers.

Requirements

Anki-Sync requires python3 to run. Additionally, software listed in requirements.txt will have to be installed for the system to function properly. The recommended installation method is by using virtual-environments or conda, but a global pip install would work as well.

Additionally, certain endpoints require additional configuration:

  • Anki: Anki requires Anki-Connect installed and running on the local system. A restart of Anki will be required after installing the plugin.

Installation

Check if python is installed

First, check if Python is already installed on your system by running the following command in your terminal:

python3 --version

If Python is installed, you should see something like this:

Python 3.10.9

If Python is not installed, you can install it by following the next step.

Install python

To install Python3 on your system, open your terminal and enter the following command:

sudo apt-get install python3

This will install Python3 on your system.

Install Virtualenv

Next, you'll need to install Virtualenv, a tool for creating isolated Python environments. You can do this by running the following command in your terminal:

sudo apt-get install virtualenv

Create a Virtual Environment

Now that you have Virtualenv installed, you can create a virtual environment for the Python project. To do this, navigate to the directory where you want to create your environment and run the following command:

virtualenv venv

This will create a new virtual environment called "venv" in the current directory.

Activate the Virtual Environment

To activate your new virtual environment, run the following command:

source venv/bin/activate

You should see your terminal prompt change to indicate that you are now in your virtual environment.

Install Packages

Now that you're in your virtual environment, you can install any packages you need for your project using pip. To install all currently required packages, you can run the following command:

pip install -r requirements.txt

Endpoints

Following is a table of what default endpoints are currently available, and which kind of manipulation they can be used for:

Name NoteProvider NoteConsumer BaseProvider
Anki Yes Yes No
Jisho No No Yes
Wanikani Yes No Yes
split No No Yes
replace_prefix No No Yes
replace_suffix No No Yes
replace No No Yes
  • NoteProvider: Allows the system to read notes from the specific source
  • NoteConsumer: Allows the system to store or update notes to the specific source
  • BaseProvider: Enhances notes by modifying or updating information

Configuration

This project uses a single settings.json file as it's main source for configuration. The file is separated in two sections; endpoints and config.

{
  "endpoints": {},
  "config": []
}

Endpoints

Endpoints contain the general endpoint configuration. Each endpoint will be referenced by name at least once for it to be considered enabled. Even an empty object will cause the endpoint to be active, but some might require a bit more to be any kind of use.

Wanikani

{
  "wanikani": {
    "api_token": "<The api token from https://www.wanikani.com/settings/personal_access_tokens>"
  }
}

Anki

{
  "anki": {
    "target_deck": "<Target Anki-Deck name>"
  }
}

Jisho

{
  "jisho": {}
}

Replace Prefix

{
  "replace_prefix": {
    "source_field": "Question",
    "search_string": "<Prefix to be removed>",
    "replacement_string": "<replacement or empty string>"
  }
}

Replace Suffix

{
  "replace_suffix": {
    "source_field": "Question",
    "search_string": "<Suffix to be removed>",
    "replacement_string": "<replacement or empty string>"
  }
}

Replace

{
  "replace": {
    "source_field": "Question",
    "search_string": "<String to be removed>",
    "replacement_string": "<replacement or empty string>"
  }
}

Split

{
  "split": {
    "source_field": "Question",
    "search_string": "<String to split by. Only first occurrence will be used>",
    "target_field_left": "<Field to store the left part of the string>",
    "target_field_right": "<Field to store the right part of the string>"
  }
}

Config

The config section configures the synchronization steps to be taken. Each step consists of a provider (source) and a consumer (target). Notes are initially loaded from the provider, modified and enhanced by the providers listed in enrichment and stored to the consumer. The source and target may be the same endpoint, to allow for update scenarios.

Adding Wanikani Information to notes

[
  {
      "source": "anki",
      "target": "anki",
      "enrichment": [
        "wanikani"
      ]
    }
]

Importing vocabulary from Wanikani into anki

{
  "source": "wanikani",
  "target": "anki"
}

Cleaning and separating input

This scenario assumes a Question in the following pattern: <ruby>Kanji<rt>Hiragana</rt></ruby> Which is the format sometimes used in the official Genki Notes. It separates the Kanji and Hiragana parts into two separate fields.

{
  "source": "anki",
  "target": "anki",
  "example": "口<rt>くち",
  "enrichment": [
    "replace_prefix",
    "replace_suffix",
    "split"
  ]
}

anki-sync's People

Contributors

euklios avatar

Watchers

 avatar

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.