Adding a mecab user dictionary does not reflect it.

Asked 2 years ago, Updated 2 years ago, 88 views

The environment is Mac OS High Sierra.
In order to register a new dictionary in mecab, I created csv(utf-8) as below and added it as a user dictionary.

hepatic dysfunction,,0,noun,general,*,*,*,*,*,*,*,*

I'm doing it in the following way:

 ➜userdic/usr/local/libexec/mecab/mecab-dict-index\
-d/usr/local/lib/mecab/dic/ipadic\
-u/usr/local/lib/mecab/dic/userdic/medical.dic\
-ftf-8-tutf-8 medical_terms.csv
reading medical_terms.csv...1
emmitting double-array: 100% |######################################################################################################

Done!
➜ userdics
medical.dical_terms.csv

➜ userdic echo 'hepatic dysfunction' | mecab-u medical.dic-N2
hepatic prefix, noun connection, *, *, *, *, liver, can, can
function noun, subvariable connection, *, *, *, *, function, quino, quino
disability nouns, general, *, *, *, *, disability, show guy, show guy
EOS
liver noun, general, *, *, *, *, liver, chrysanthemum, chrysanthemum
function noun, subvariable connection, *, *, *, *, function, quino, quino
disability nouns, general, *, *, *, *, disability, show guy, show guy
EOS

As mentioned above, the mecab-dict-index has been successfully executed.There should be no problem with the IPA part of speech system.Considering the cost issue, -N2 option is added, but it seems that the user dictionary I created this time is not reflected.

What other causes can you think of?I look forward to your kind cooperation.

mecab

2022-09-29 21:31

1 Answers

A user dictionary has been created, but it is not in use.

If you created it in mecab userdic, register it in mecab's configuration file.

The configuration method is as follows in the mecab documentation.

Verify /home/foo/bar/foo.dic is ready
Add the following to /usr/local/lib/mecab/dic/ipadic/dicrc or /usr/local/etc/mecabrc

userdic=/home/foo/bar/foo.dic

If you are not authorized to edit /usr/local/etc/mecabrc, copy /usr/local/etc/mecabrc to ~/.mecabrc and add the above entry

Userdic can be multiple CSV format
userdic=/home/foo/bar/foo.dic,/home/foo/bar2/usr.dic,/home/foo/bar3/bar.dic

Also, if you want to use the -u option in the current directory, use the folder where the dictionary is created as the current directory.

userdic/usr/local/libexec/mecab/mecab-dict-index\
-d/usr/local/lib/mecab/dic/ipadic\
-u medical.dic\
-ftf-8-tutf-8 medical_terms.csv


2022-09-29 21:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.