minhon 0.1.11

dotnet add package minhon --version 0.1.11
NuGet\Install-Package minhon -Version 0.1.11
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="minhon" Version="0.1.11" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add minhon --version 0.1.11
#r "nuget: minhon, 0.1.11"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install minhon as a Cake Addin
#addin nuget:?package=minhon&version=0.1.11

// Install minhon as a Cake Tool
#tool nuget:?package=minhon&version=0.1.11

minhon_dotnet

Package NuGet version

「みんなの自動翻訳」のWeb APIを.NETから利用するためのライブラリです。

インストール

NuGetからインストールできます。

dotnet add package minhon

使い方

APIキーの取得

「みんなの自動翻訳」にアクセスし、アカウントを作成します。
アカウントを作成したら、設定からAPIキーおよびAPIシークレットを取得します。

アクセストークンの取得

「みんなの自動翻訳」のWeb APIはOAuth2を利用しています。 以下ではIdentityModel.OidcClientを利用してアクセストークンを取得します。

var httpClient = new HttpClient();
var response = await httpClient.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
{
    Address = "https://mt-auto-minhon-mlt.ucri.jgn-x.jp/oauth2/token.php",
    ClientId = apiKey, // 設定ページで取得したAPIキー
    ClientSecret = apiSecret, // 設定ページで取得したAPIシークレット
});

翻訳

// クライアントの作成
var client = RestService.For<IMachineTranslationClient>("https://mt-auto-minhon-mlt.ucri.jgn-x.jp");

// 翻訳
var res = await client.Translate(TranslateMode.TransLM, LanguageCode.Ja, LanguageCode.En, new(
    apiKey, // 設定ページで取得したAPIキー
    name, // ログインID
    response.AccessToken, // アクセストークン
    """
    「みんなの自動翻訳@TexTra®」は、自動翻訳をみんなで育てるサイトです。
    あらかじめ登録された自動翻訳を試したり、自動でファイルを翻訳できたり、サイト上で翻訳エディタを使用して自分で翻訳することができます。
    ※「みんなの自動翻訳」は、国立研究開発法人情報通信研究機構の登録商標です(第6120510号)。
    ※「TexTra」は、国立研究開発法人情報通信研究機構の登録商標です(第5398294号)。
    ※国立研究開発法人情報通信研究機構 ユニバーサルコミュニケーション研究所 先進的音声翻訳研究開発推進センターは、情報セキュリティマネジメントシステムの国際規格である「ISO/IEC27001」の認証を取得しています。認証範囲は、「先進的音声翻訳研究開発推進センターの音声処理技術及び機械翻訳技術の研究開発、音声コーパス、対訳コーパス、並びに関連する言語コーパスの構築」です。
    """));
if (res is { ResultSet: { Result: { Information: { Sentences: { } sentences } } } })
{
    foreach (var sentence in sentences)
    {
        Console.WriteLine(sentence);
    }
}
else
{
    Console.WriteLine(res);
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.11 151 1/3/2024
0.1.10 86 1/3/2024
0.1.9 87 1/3/2024