Skip to content

KuromojiAnalyzer is not a constructor #109

Description

@ChesterAiGo

I know everyone's getting Kuroshiro is not a constructor and resolves the problem with adding a default

But i don't see anyone getting this weird error as mine:

KuromojiAnalyzer is not a constructor
TypeError: KuromojiAnalyzer is not a constructor

My code is:

const Kuroshiro = require("kuroshiro").default;
const KuromojiAnalyzer = require("kuroshiro-analyzer-kuromoji");


function someComponent({ text }) {

  const kuroshiro = new Kuroshiro();
  const analyzer = new KuromojiAnalyzer();

  // Convert the Japanese text to Romaji
  let captionedText;
  kuroshiro.init(analyzer)
    .then(function(){
      captionedText = kuroshiro.convert(text, { to: "romaji" });
    })
    .then(function(captionedText){
        console.log(captionedText);
    })
    

and it fails with the error above
Any hint or help would be immensely appreciated! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions