Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KuromojiAnalyzer is not a constructor #109

Open
ChesterAiGo opened this issue Jul 15, 2023 · 0 comments
Open

KuromojiAnalyzer is not a constructor #109

ChesterAiGo opened this issue Jul 15, 2023 · 0 comments

Comments

@ChesterAiGo
Copy link

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! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant