RecognitionBridge
디지털 잉크 인식 provider 어댑터 + 후보 정규화
상태
| 항목 | 값 |
|---|---|
| Layer | core |
| Tier | L1 |
| Status | wip |
| Version | 0.9.0 |
| 가격 | Free (free) |
| **카� | |
| �고리** | Input & UX |
개요
개요
RecognitionBridge 는 multi-saas-kit 의 Layer 1 Core Plugin � 니다. DigitalInk stroke 데이터를 외부 인식 provider 로 전송하고 후보 � �스트를 표준 결과로 정규화하는 어댑터 계층� 니다.
provider 의 서비스 운영, 가격 정� , 사용량 과금은 이 plugin 의 � 임이 아닙니다. 예를 들어 apis.how Hand Writer 는 RecognitionBridge 가 호출할 수 있는 provider 중 하나이며, apis.how 의 상품/과금 정� 은 apis.how 프로젝트가 담당합니다.
DigitalInk(stroke 표준) + BrushConfiguration(렌더 설정) 와 함께 HandwritingInput Composite 의 3대 base 중 하나.
핵심 컴포넌트
RecognizerInterface
모든 인식 어댑터의 공통 계약:
interface RecognizerInterface {
public function recognize(
array $ink, int $width, int $height,
?string $language = null, ?string $mode = null, ?int $returnCount = null,
): RecognitionResult;
}
RecognitionResult (DTO)
표준 결과 shape — ok, provider, elapsed_ms, candidates, message. success() / failure() named constructors.
CandidateNormalizer (Pure)
인식 응답에서 candidates 추출. 3가지 shape 자동 인식:
| 응답 shape | 출처 |
|---|---|
['candidates' => [...]] | Hand Writer API |
['data' => ['candidates' => [...]]] | wrapping 변형 |
[_, [[_, [...]]]] | Google Input Tools native |
추가 처리: trim, mode='numeric' 시 numeric_regex (/^[0-9]{1,6}$/) 매칭, 빈 문자열 / 중복 제거, return_count clamp (1~10).
HandWriterRecognizer (어댑터)
apis.how /api/v1/handwriting/recognize Bearer 토큰 호출 어댑터. API 키 누락 / 5xx / 네트워크 예외 모두 RecognitionResult::failure() 로 안전 fallback. X-Client-Origin / X-Client-Domain 헤더 첨부.
GoogleInputToolsRecognizer (어댑터)
Google Input Tools request endpoint 무인증 fallback 어댑터.
RecognizerChain
여러 recognizer 를 순차 시도. 첫 번째 ok=true 결과 즉시 반환. 모두 실패 시 마지막 결과 반환. 빈 chain → failure(null, 0, 'No recognizers configured.').