テキストマイニングで熟語を指定する方法
10 views (last 30 days)
Show older comments
Text Analytics Toolboxを用いてテキストマイニングを行っています。
tokenizedDocumentによりドキュメントをトークン化する際、熟語が想定と異なる分けられ方をしてしまいます。
例えば、近赤外分光で1つの熟語(もしくは近赤外、分光で2つの熟語)として欲しいのですが、近、赤、外、分光で4つのトークンに分かれてしまいます。
ある文字列を熟語として設定する方法はあるのでしょうか。
よろしくお願いします。
0 Comments
Accepted Answer
Kojiro Saito
on 18 Feb 2025
Edited: Kojiro Saito
on 18 Feb 2025
ただ、「近赤外」、「分光」でうまく分けられなかったので、カスタムトークンのオプションを入れる方法も紹介します。
str = "近赤外分光";
%% Thesaurus2015.dicを使用
options = mecabOptions('UserModel', 'Thesaurus2015.dic')
documents = tokenizedDocument(str, 'TokenizeMethod', options) % 1 個のトークン: 近赤外分光
%% Nikkaji.dicを使用
options = mecabOptions('UserModel', 'Nikkaji.dic')
documents = tokenizedDocument(str, 'TokenizeMethod', options) % 4 個のトークン: 近 赤 外 分光
%% JSTMeSH.dicを使用
options = mecabOptions('UserModel', 'JSTMeSH.dic')
documents = tokenizedDocument(str, 'TokenizeMethod', options) % 4 個のトークン: 近 赤 外 分光
%% カスタムトークンを使用
documents = tokenizedDocument(str, CustomTokens=["近赤外" "分光"]) % 2 個のトークン: 近赤外 分光
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!