レビュー文
概要説明
データセット履歴内の特定の製品のレビュー文を取得します。特定視点(SPVP)とAI視点の2つのモードをサポートします。
Swagger リンク
API: Review Sentences API
アクティビティ図
---
config:
theme: base
layout: dagre
flowchart:
curve: linear
htmlLabels: true
themeVariables:
edgeLabelBackground: "transparent"
---
flowchart TB
Client[Client Application]
API[ProductAnalyzerController]
Dataset[Dataset Validation]
Spvp(SpvpService)
PAService(ProductAnalyzerService)
DB[(Database)]
Client --- Step1[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>1</span>
<p style='margin-top: 8px'>GET リクエスト送信</p>
</div>
]
Step1 --> API
API --- Step2[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>2</span>
<p style='margin-top: 8px'>データセット検証</p>
</div>
]
Step2 --> Dataset
API --- Step3A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3A</span>
<p style='margin-top: 8px'>特定視点</p>
</div>
]
Step3A --> Spvp
Spvp --> DB
DB --> Spvp
API --- Step3B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3B</span>
<p style='margin-top: 8px'>AI視点</p>
</div>
]
Step3B --> PAService
PAService --> DB
DB --> PAService
Spvp --- Step4A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4A</span>
<p style='margin-top: 8px'>フォーマット/ページネーション</p>
</div>
]
PAService --- Step4B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4B</span>
<p style='margin-top: 8px'>フォーマット/ページネーション</p>
</div>
]
Step4A --> API
Step4B --> API
API --- Step5[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>5</span>
<p style='margin-top: 8px'>JSON レスポンス送信</p>
</div>
]
Step5 --> Client
%% Styling
style Client fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
style API fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
style Dataset fill:#f0f8e6,stroke:#339933,stroke-width:2px
style Spvp fill:#f0f8e6,stroke:#339933,stroke-width:2px
style PAService fill:#f0f8e6,stroke:#339933,stroke-width:2px
style DB fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
style Step1 fill:transparent,stroke:transparent,stroke-width:1px
style Step2 fill:transparent,stroke:transparent,stroke-width:1px
style Step3A fill:transparent,stroke:transparent,stroke-width:1px
style Step3B fill:transparent,stroke:transparent,stroke-width:1px
style Step4A fill:transparent,stroke:transparent,stroke-width:1px
style Step4B fill:transparent,stroke:transparent,stroke-width:1px
style Step5 fill:transparent,stroke:transparent,stroke-width:1px
API エンドポイント
- GET
/api/v1/general/analysis/{wldh_slug}/review-sentences
クエリパラメータ
| パラメータ | タイプ | 必須 | 説明 |
|---|---|---|---|
product_id |
string | はい | 分析対象の製品ID |
viewpoint_type |
string | はい | 視点タイプ(ai または spvp) |
viewpoint_id |
string | 条件付き | SPVPモードの場合の視点ID |
page |
integer | いいえ | ページ番号(デフォルト: 1) |
per_page |
integer | いいえ | 1ページあたりのアイテム数(デフォルト: 20) |
レスポンス形式
AI視点モード
{
"success": true,
"data": {
"sentences": [
{
"id": "sentence_id",
"text": "レビュー文の内容",
"sentiment": "positive|negative|neutral",
"confidence": 0.95,
"created_at": "2024-01-01T00:00:00Z"
}
],
"pagination": {
"current_page": 1,
"per_page": 20,
"total": 100,
"last_page": 5
}
}
}
特定視点(SPVP)モード
{
"success": true,
"data": {
"sentences": [
{
"id": "sentence_id",
"text": "レビュー文の内容",
"viewpoint_score": 0.85,
"created_at": "2024-01-01T00:00:00Z"
}
],
"pagination": {
"current_page": 1,
"per_page": 20,
"total": 100,
"last_page": 5
}
}
}
エラーハンドリング
| コード | メッセージ | 説明 |
|---|---|---|
| 400 | Bad Request | 無効なパラメータ |
| 404 | Dataset not found | データセットが見つかりません |
| 422 | Validation failed | バリデーションエラー |
| 500 | Internal server error | サーバー内部エラー |
使用例
AI視点でのレビュー文取得
curl -X GET "https://api.example.com/api/v1/general/analysis/dataset-slug/review-sentences?product_id=prod123&viewpoint_type=ai&page=1&per_page=10"
特定視点でのレビュー文取得
curl -X GET "https://api.example.com/api/v1/general/analysis/dataset-slug/review-sentences?product_id=prod123&viewpoint_type=spvp&viewpoint_id=vp456&page=1&per_page=10"