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

new mecab returning empty object #16

Open
AmodeusR opened this issue Feb 27, 2023 · 5 comments
Open

new mecab returning empty object #16

AmodeusR opened this issue Feb 27, 2023 · 5 comments

Comments

@AmodeusR
Copy link

I was trying to utilize this library but when I instanciated MeCab it only returned an empty object, What's up with the library? Isn't it working anymore?

Here's a example: https://replit.com/@AmodeusR/Mecab-library-test

@crokobit
Copy link

same issue +1

@hecomi
Copy link
Owner

hecomi commented Jan 1, 2025

I apologize for the delayed response.

It’s possible that mecab-ipadic is not installed. Could you check on the console if the regular mecab command returns results correctly?

@AmodeusR
Copy link
Author

AmodeusR commented Jan 6, 2025

I don't even remember exactly what was the problem, but at least trying it now, it throws an error saying mecab was not found. How do I get it?

Error: Command failed: echo これがただの簡単な日本語の文ですよ | mecab
/bin/sh: 1: mecab: not found

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1104:16)
    at Socket.<anonymous> (node:internal/child_process:456:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:343:12) {
  code: 127,
  killed: false,
  signal: null,
  cmd: 'echo これがただの簡単な日本語の文ですよ | mecab'
}

@hecomi
Copy link
Owner

hecomi commented Jan 7, 2025

Thank you for the information. The error seems to come from the MeCab command not being accessible. Please install MeCab according to your OS (e.g., on macOS: brew install mecab and brew install mecab-ipadic) and ensure the path is set. If you’d rather not set the path globally, you can specify it directly in your code:

var MeCab = new require('mecab-async');
var mecab = new MeCab();
mecab.command = '/usr/local/bin/mecab';

@AmodeusR
Copy link
Author

AmodeusR commented Jan 8, 2025

Thank you for the information. The error seems to come from the MeCab command not being accessible. Please install MeCab according to your OS (e.g., on macOS: brew install mecab and brew install mecab-ipadic) and ensure the path is set. If you’d rather not set the path globally, you can specify it directly in your code:

Where can I download it for Windows? I tried going to Taku's MeCab website but the link is broken.

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

3 participants