How to use kuroshiro - 2 common examples

To help you get started, we’ve selected a few kuroshiro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github retorquere / zotero-better-bibtex / content / key-manager / kuroshiro.ts View on Github external
public async init() {
    log.debug('kuroshiro: initializing...')

    if (!Prefs.get('kuroshiro')) {
      log.debug('kuroshiro: disabled')
      return
    }

    try {
      this.kuroshiro = new Kuroshiro()
      await this.kuroshiro.init(new KuromojiAnalyzer('resource://zotero-better-bibtex/kuromoji'))
    } catch (err) {
      log.error('kuroshiro: initializing failed')
      throw err
    }

    log.debug('kuroshiro: ready')
    this.enabled = true
  }
github retorquere / zotero-better-bibtex / content / key-manager / kuroshiro.ts View on Github external
public convert(str, options) {
    if (!this.enabled) throw new Error('kuroshiro not initialized')
    if (str && Kuroshiro.Util.hasJapanese(str)) return this.kuroshiro.convert(str, options)
    return str
  }
}

kuroshiro

kuroshiro is a Japanese language library for converting Japanese sentence to Hiragana, Katakana or Romaji with furigana and okurigana modes supported.

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis