TextVectorAPI
TextVectorAPI Reference
TextVectorAPI は、入力されたテキストをベクトル形式に変換するための API です。この API を利用することで、テキストデータを機械学習モデルやデータ分析ツールで扱いやすい形式に変換できます。
導入用途
自然言語処理(NLP) テキストデータのベクトル化により、クラスタリングや類似性分析を実現します。
検索エンジンの強化 ベクトル検索を用いて、意味的に関連性のあるドキュメントや回答を検索できます。
推薦システムの構築 テキストコンテンツ間の類似性を分析して、コンテンツの推薦機能を実装します。
AIモデルの前処理 テキストデータをエンコードして、ディープラーニングモデルの入力として使用します。
Base URL
https://textvectorapi-mixederapi.mixeder.com/
Endpoints
GET /
指定されたテキストをベクトル形式に変換します。
Headers
ヘッダー名
必須
説明
Content-Type
はい
application/json
Query Parameters
パラメーター名
必須
説明
key
はい
使用する API キー
text
はい
ベクトル化するテキスト
Response
成功時: HTTP Status: 200 Body:
{ "message": "API authentication, vectorization, and billing completed successfully", "username": "user", "vectorization": { "shape": [ 1, 768 ], "data": [ [ -0.0062803165055811405, 0.02522544004023075, 0.02596879191696644, 0.0022791167721152306, 0.014218125492334366, 0.019512472674250603, 0.006175754591822624, 0.0308975987136364, -0.04236556962132454 ] ] }, "billingResponse": "{\"status\":\"success\"}" }
エラー時: HTTP Status: 400 または 500 Body:
{ "error": "Error message" }
サンプルコード
JavaScript Fetch Example
async function vectorizeText(apiKey, text) {
const apiUrl = 'https://textvectorapi-mixederapi.mixeder.com/';
const queryParams = new URLSearchParams({ key: apiKey, text });
try {
const response = await fetch(`${apiUrl}?${queryParams.toString()}`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
if (!response.ok) {
throw new Error(`API error: ${response.statusText}`);
}
const data = await response.json();
console.log('Text vectorization result:', data.vectorization);
return data.vectorization;
} catch (error) {
console.error('Error during text vectorization:', error.message);
throw error;
}
}
// 使用例
vectorizeText('your-api-key', 'example text')
.then((result) => console.log('Vectorization Result:', result))
.catch((err) => console.error('Vectorization failed:', err));
Python Requests Example
import requests
def vectorize_text(api_key, text):
api_url = 'https://textvectorapi-mixederapi.mixeder.com/'
params = {
"key": api_key,
"text": text,
}
try:
response = requests.get(api_url, params=params)
response.raise_for_status()
data = response.json()
print("Text vectorization result:", data["vectorization"])
return data["vectorization"]
except requests.exceptions.RequestException as e:
print("Error during text vectorization:", e)
raise
# 使用例
vectorize_text("your-api-key", "example text")
cURL Example
curl -X GET 'https://textvectorapi-mixederapi.mixeder.com/?key=your-api-key&text=example%20text' \
-H "Content-Type: application/json"
料金計算
サービス名:
TextVectorAPI
単位あたり料金: 0.05
最終更新
役に立ちましたか?