style: Pint 포맷팅 적용
This commit is contained in:
@@ -97,6 +97,7 @@ public function getAccessToken(): ?string
|
||||
|
||||
/**
|
||||
* GCS에 파일 업로드
|
||||
*
|
||||
* @return array|null ['uri' => 'gs://...', 'size' => bytes] or null
|
||||
*/
|
||||
public function uploadToStorage(string $localPath, string $objectName): ?array
|
||||
@@ -153,6 +154,7 @@ public function uploadToStorage(string $localPath, string $objectName): ?array
|
||||
|
||||
/**
|
||||
* Base64 오디오를 GCS에 업로드
|
||||
*
|
||||
* @return array|null ['uri' => 'gs://...', 'size' => bytes] or null
|
||||
*/
|
||||
public function uploadBase64Audio(string $base64Audio, string $objectName): ?array
|
||||
@@ -415,7 +417,7 @@ private function parseDiarizationResult(array $operationResult): ?array
|
||||
// word-level 결과 없으면 일반 transcript로 폴백
|
||||
$transcript = '';
|
||||
foreach ($results as $res) {
|
||||
$transcript .= ($res['alternatives'][0]['transcript'] ?? '') . ' ';
|
||||
$transcript .= ($res['alternatives'][0]['transcript'] ?? '').' ';
|
||||
}
|
||||
$transcript = $this->cleanSttText(trim($transcript));
|
||||
|
||||
@@ -428,7 +430,7 @@ private function parseDiarizationResult(array $operationResult): ?array
|
||||
'end_time_ms' => null,
|
||||
'is_manual_speaker' => false,
|
||||
]],
|
||||
'full_transcript' => '[화자 1] ' . $transcript,
|
||||
'full_transcript' => '[화자 1] '.$transcript,
|
||||
'speaker_count' => 1,
|
||||
];
|
||||
}
|
||||
@@ -457,7 +459,7 @@ private function parseDiarizationResult(array $operationResult): ?array
|
||||
|
||||
if ($speakerTag !== $currentSpeaker && $currentSpeaker !== null && ! empty($currentTokens)) {
|
||||
$segments[] = [
|
||||
'speaker_name' => '화자 ' . $currentSpeaker,
|
||||
'speaker_name' => '화자 '.$currentSpeaker,
|
||||
'speaker_label' => (string) $currentSpeaker,
|
||||
'text' => $this->joinSentencePieceTokens($currentTokens),
|
||||
'start_time_ms' => $segmentStartMs,
|
||||
@@ -476,7 +478,7 @@ private function parseDiarizationResult(array $operationResult): ?array
|
||||
if (! empty($currentTokens)) {
|
||||
$lastWord = end($words);
|
||||
$segments[] = [
|
||||
'speaker_name' => '화자 ' . $currentSpeaker,
|
||||
'speaker_name' => '화자 '.$currentSpeaker,
|
||||
'speaker_label' => (string) $currentSpeaker,
|
||||
'text' => $this->joinSentencePieceTokens($currentTokens),
|
||||
'start_time_ms' => $segmentStartMs,
|
||||
@@ -526,7 +528,7 @@ private function joinSentencePieceTokens(array $tokens): string
|
||||
if ($i === 0) {
|
||||
$result = $token['text'];
|
||||
} elseif ($token['new_word']) {
|
||||
$result .= ' ' . $token['text'];
|
||||
$result .= ' '.$token['text'];
|
||||
} else {
|
||||
$result .= $token['text'];
|
||||
}
|
||||
@@ -739,7 +741,7 @@ private function parseV2Result(array $operationResult, string $gcsUri): ?array
|
||||
// word-level 결과 없으면 일반 transcript 사용
|
||||
$transcript = '';
|
||||
foreach ($results as $res) {
|
||||
$transcript .= ($res['alternatives'][0]['transcript'] ?? '') . ' ';
|
||||
$transcript .= ($res['alternatives'][0]['transcript'] ?? '').' ';
|
||||
}
|
||||
$transcript = trim($transcript);
|
||||
|
||||
@@ -752,7 +754,7 @@ private function parseV2Result(array $operationResult, string $gcsUri): ?array
|
||||
'end_time_ms' => null,
|
||||
'is_manual_speaker' => false,
|
||||
]],
|
||||
'full_transcript' => '[화자 1] ' . $transcript,
|
||||
'full_transcript' => '[화자 1] '.$transcript,
|
||||
'speaker_count' => 1,
|
||||
];
|
||||
}
|
||||
@@ -789,7 +791,7 @@ private function parseV2Result(array $operationResult, string $gcsUri): ?array
|
||||
|
||||
if ($speakerTag !== $currentSpeaker && $currentSpeaker !== null && ! empty($currentTokens)) {
|
||||
$segments[] = [
|
||||
'speaker_name' => '화자 ' . $currentSpeaker,
|
||||
'speaker_name' => '화자 '.$currentSpeaker,
|
||||
'speaker_label' => (string) $currentSpeaker,
|
||||
'text' => $this->joinSentencePieceTokens($currentTokens),
|
||||
'start_time_ms' => $segmentStartMs,
|
||||
@@ -806,7 +808,7 @@ private function parseV2Result(array $operationResult, string $gcsUri): ?array
|
||||
// 일반 단어 방식 처리 (Chirp 2)
|
||||
if ($speakerTag !== $currentSpeaker && $currentSpeaker !== null && ! empty($currentWords)) {
|
||||
$segments[] = [
|
||||
'speaker_name' => '화자 ' . $currentSpeaker,
|
||||
'speaker_name' => '화자 '.$currentSpeaker,
|
||||
'speaker_label' => (string) $currentSpeaker,
|
||||
'text' => implode(' ', $currentWords),
|
||||
'start_time_ms' => $segmentStartMs,
|
||||
@@ -826,7 +828,7 @@ private function parseV2Result(array $operationResult, string $gcsUri): ?array
|
||||
if ($hasSentencePiece && ! empty($currentTokens)) {
|
||||
$lastWord = end($words);
|
||||
$segments[] = [
|
||||
'speaker_name' => '화자 ' . $currentSpeaker,
|
||||
'speaker_name' => '화자 '.$currentSpeaker,
|
||||
'speaker_label' => (string) $currentSpeaker,
|
||||
'text' => $this->joinSentencePieceTokens($currentTokens),
|
||||
'start_time_ms' => $segmentStartMs,
|
||||
@@ -836,7 +838,7 @@ private function parseV2Result(array $operationResult, string $gcsUri): ?array
|
||||
} elseif (! $hasSentencePiece && ! empty($currentWords)) {
|
||||
$lastWord = end($words);
|
||||
$segments[] = [
|
||||
'speaker_name' => '화자 ' . $currentSpeaker,
|
||||
'speaker_name' => '화자 '.$currentSpeaker,
|
||||
'speaker_label' => (string) $currentSpeaker,
|
||||
'text' => implode(' ', $currentWords),
|
||||
'start_time_ms' => $segmentStartMs,
|
||||
|
||||
Reference in New Issue
Block a user