GithubHelp home page GithubHelp logo

xoltia / yawaeijisho Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 529 KB

Japanese-English dictionary web app with lists and Anki-Connect support.

License: MIT License

JavaScript 12.25% HTML 0.51% Vue 40.95% TypeScript 37.86% Dockerfile 0.38% Shell 0.39% Go 7.66%
vue mongodb jmdict express anki

yawaeijisho's Introduction

Yawaeijisho

Yet another Japanese-English dictionary

Usage

Most features other than word lookup require you to make an account.

Lists

Once you have an account, you can click the lists link in the top left (desktop)/menu (mobile) to create a list. Once you have a list, you can use the link actions on words to add them to lists.

Anki

In order to use Anki you need to have Anki-Connect and to add the site domain to your CORS configuration. Click the status dot in the top left to modify Anki-Connect URL if you are using a non-standard one. This page is also where you will pick a deck and model to use for creating notes. Finally, you will need to write your own script for mapping words to your model. You can create such scripts from the "Functions tab" of the same page".

Within the word function context, you have access to both the raw JMDict entry and the processed entry as served by the API. (jWord/word and yWord respectively). You can get user input with the global function input which takes in a prompt string and an array of string options, returning a promise of the string selected (do not try to await instead use .then). Your script should have one call to finish with an object where the keys match with the expected models fields.

For example, if your Anki model has three fields (Word, Meaning, Reading) then your object should look like

finish({
  'Word': word,
  'Meaning': meaning,
  'Reading': reading
});

Note that your script will NOT run in the browser, as such you only have access to these methods and objects as globals. You do not have any of the normal browser APIs.

Planned and current features

This project is an attempt to make a website similar to jisho.org but with some additional features.

Original features:

  • On-site word lists
  • Anki note builder (using user created functions)
  • Japanese UI option

Characteristics shared with Jisho.org:

  • Whole sentence search
  • Kanji info (only based on kanji included in search string, not reading)

Differences from Jisho.org:

  • Word entries are broken down based on applicable kanji/kana pairs (where jisho would show one entry with some marked as "only applies to XXX", this app will show them as seperate entries
  • Kanji info has different (currently less) info
  • Results are loaded in on the same page instead of navigating to the next page
  • Only Japanese -> English search. Input is automatically converted to kana if you type with EN input method.

Features I would like to implement:

  • Wild card searches (* and ?)
  • Example sentences
  • Advanced searching (filters, sorters, radical search)
  • More features for note functions

API Setup

Current prerequisites include

Environment variables

โ€ป Non-exhaustive, view config.ts for all environment variables.

Variable Description Default
PORT Port which API server runs on (do not change if not production) production: 80
dev: 3080 (same as front-end dev proxy)
NODE_ENV 'production' or 'dev'; Production serves static files from client\dist dev
JMDICT_LOCATION Location of JMDict file (important, will not run without) None
USE_INDEX_FILE Whether or not to save created indexes (kanji/kana search indexes) to a file for re-use. Recommended to speed up subsequent startups false
MAX_PAGE_SIZE Maximum amount of words allowed to be returned by /api/define endpoint 25
TOKEN_SECRET Secret used to create user tokens None
DB_CONNECTION_URI MongoDB connection URL (optionally you can also specifiy individual components, view config.ts source file) mongodb://localhost:27017/yawaeijisho
MECAB_SHIFT_JIS 'true' if mecab installed with Shift JIS false
FUNCBOX_URI URL (with ws protocol) of server which will serve as the "funcbox" ws://localhost:3090/ws
PUBLIC_FOLDER Where the built client is (when running in production) ../../client/dist

Client setup

Uses basic vue cli commands. View the README file in the client directory for more info.

Funcbox setup

Does not currently build on Windows (because of v8go dependency). You can use WSL to get around this. Simply build and run the program before running the API.

Run with -help for information about arguments.

Starting

First, start the Funcbox server. Then run npm start in the API folder to start the API. Finally, run npm run serve in the client folder. (You do not need to do this if running in production mode, however, make sure to run npm run build-client first)

yawaeijisho's People

Contributors

xoltia avatar

Stargazers

 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.