
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
dev.natsuume.knp4j:knp4j
Advanced tools
This is the wrapper that call KNP( Japanese morpheme, dependency, case analyzer ) in Java.
JUMAN(JUMAN++)、KNPのプロセスをJavaから実行して結果を取得するライブラリです。
https://search.maven.org/artifact/dev.natsuume/knp4j
<dependency>
<groupId>dev.natsuume.knp4j</groupId>
<artifactId>knp4j</artifactId>
<version>1.1.3</version>
</dependency>
implementation 'dev.natsuume.knp4j:knp4j:1.1.3'
下記のように使用することができます。
各種オプションのうちParserの設定は必須です。
また、それ以外のオプションについては下記例の内容がデフォルトで使用されます。
//KNPWrapperを作成するためのBuilder
ResultParser<KnpResult> knpResultParser = new KnpResultParser();
KnpWrapperBuilder<KnpResult> knpWrapperBuilder = new KnpWrapperBuilder<>();
KnpWrapper<KnpResult> wrapper = knpWrapperBuilder
.setJumanCommand(List.of("bash", "-c", "jumanpp")) //Jumanの実行コマンド
.setKnpCommand(List.of("bash", "-c", "knp -tab -print-num -anaphora")) //KNPの実行コマンド(現在は「-tab」「-print-num」「-anaphora」オプション必須)
.setJumanMaxNum(1) //同時に起動するJumanの最大プロセス数
.setJumanStartNum(1) //初期化時に起動するJumanのプロセス数
.setKnpMaxNum(1) //同時に起動するKNPの最大プロセス数
.setKnpStartNum(1) //初期化時に起動するKNPのプロセス数
.setRetryNum(0) //結果の取得に失敗した場合にリトライする回数
.setResultParser(knpResultParser) //出力結果のList<String>を任意のクラスに変換するParserを設定する
.start();
var texts = List.of(
"テストテキスト1です",
"テストテキスト2です",
"テストテキスト3です"
);
texts.parallelStream().map(wrapper::analyze)
.flatMap(List::stream)
.map(KnpResult::getSurfaceForm)
.forEach(System.out::println);
現在KNPの解析結果ParserとしてKnpResultParserのみ実装されています。
KnpResultは下記メソッドを持ちます。
/**
* 文節のリストを返す.
*
* @return 文節の一覧
*/
List<KnpClause> getClauses();
/**
* 形態素のリストを返す.
*
* @return 形態素の一覧
*/
List<KnpMorpheme> getMorphemes();
/**
* 基本句のリストを返す.
*
* @return 基本句の一覧
*/
List<KnpPhrase> getPhrases();
/**
* 文末の文節を返す. 要素が存在しないときはnullを返す.
*
* @return 文末のKnpClause
*/
KnpClause getRootNode();
/**
* KNPの出力結果の文字列リストを返す.
*
* @return 出力結果
*/
List<String> getRawResultData();
/**
* 入力された表層文字列を返す.
*
* @return 入力文字列
*/
String getSurfaceForm();
/**
* 解析スコアを返す.
*
* @return 解析スコア
*/
double getScore();
/**
* 正常な解析結果かどうかを返す.
*
* @return 正常な解析結果かどうか
*/
boolean isValid();
なお現在、JUMAN, KNPについてサーバモードでの起動は対応していません。
このソフトウェアは下記を使用しています。
これらのライセンス条項はLICENSEにあります。
このソフトウェアはソースコードのFormatにcheckstyleのgoogle_checks.xmlを利用しています。
上記ファイルのライセンス条項はcheckstyle_LICENSEにあります。
POSTPOSITIONAL_PARTICLE
を追加#
が含まれる場合にKnpResultBuilderがparsingに失敗する問題を修正-anaphora
オプションを削除FAQs
This is the wrapper that call KNP( Japanese morpheme, dependency, case analyzer ) in Java.
We found that dev.natsuume.knp4j:knp4j demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.