Skip to content

Latest commit

 

History

History
35 lines (32 loc) · 1.91 KB

README.md

File metadata and controls

35 lines (32 loc) · 1.91 KB

Intro

Flashcard maker is a simple TypeScript application which reads a PDF file, and then uses Claude to generate Anki-compatible cloze flashcards (as CSV file). Thanks to use of carefully crafted prompting rules, the clozes are placed over the most important fact in the card - at least, most of the time! Meanwhile, it ignores paragraphs discussing historical information, trivia, and similar. These 2 features - smart cloze placement, and omitting irrelevant details - distinguishes the application from existing third-party solutions.

Instructions

  1. Clone the project:
git clone https://github.com/antea-p/flashcard_maker.git
  1. To proceed, you will need npm. If on Windows, see this article: https://phoenixnap.com/kb/install-node-js-npm-on-windows
  2. Then, install ts-node package. If desired, you can install it on global level:
npm install -g ts-node 
  1. Navigate to the project's root directory, open your terminal, and get the rest of the dependencies by executing:
npm install
  1. Create .env file with following contents: ANTHROPIC_ACCESS_KEY=YOUR_ANTHROPIC_TOKEN_GOES_HERE
  2. In index.ts, change the following line:
const filePath = `RELATIVE_OR_ABSOLUTE_PATH_TO_YOUR_PDF`;
  1. Execute the following command:
npx ts-node index.ts

Note: Keep in mind that each time you execute the script, your old output.csv will be overwritten with fresh data! If you want to avoid this, please change the following line:

console.log(await writeCsv('output.csv', allClozes));
  1. Open Anki, and select any deck you wish. Then, go to File --> Import..., and select your CSV file. In new dialog, change Field separator to Semicolon. Use of Enhanced Cloze as your Note Type is highly recommended, though optional. image