0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

YAHOOAPIで 不適切な表現をチェック

Posted at

エロワードや誹謗中傷系のキーワードを検索することは不可能。
このAPIはあくまで "セキュリティー" という単語の代わりになにか使えるか?
などをお知らせしてくれるだけで、エロ系に対しては無反応。
ただ、laravelのHTTP(file_get_contentsの代わり)での使い方がわかったのでメモ。

校正支援 を使う

YAHOO APIキーを取得していることが条件。

hoge.php
$app_id = "your app key";//要変更
$url = "https://jlp.yahooapis.jp/KouseiService/V2/kousei";

$res = Http::withHeaders([
    'Content-Type' => "application/json",
    'User-Agent' => "Yahoo AppID:".$app_id
    ])->post($url, [
        'id' => '1234-1',
        'jsonrpc' => '2.0',
        'method' => 'jlp.kouseiservice.kousei',
    'params' => [
        'q' => "夢を見る、セキュリティー、食べれる、遊ぶ、恋愛"
    ]

]);

print_r($res->json());

結果

Array
(
    [id] => 1234-1
    [jsonrpc] => 2.0
    [result] => Array
(
    [suggestions] => Array
(
[0] => Array
(
    [length] => 7
    [note] => 語末が-tyだが昨今のネット上の慣習に準ず
    [offset] => 5
    [rule] => 用字
    [suggestion] => セキュリティ
    [word] => セキュリティー
)

[1] => Array
(
    [length] => 4
    [note] =>
    [offset] => 13
    [rule] => ら抜き
    [suggestion] => 食べられる
    [word] => 食べれる
)

)

)

)

ものすごく微妙なAPIですね

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?