공개 최종 클래스 TextSearcher
텍스트 문자열에 대한 유사성 검색을 수행합니다.
API는 선택 사항이지만 강력히 권장되는 TFLite 모델 메타데이터가 있는 TFLite 모델을 기대합니다. .
API에는 메타데이터가 채워진 TFLite 모델이 필요합니다. 메타데이터에는 다음 정보가 포함되어야 합니다.
- Bert 기반 TFLite 모델의 경우:
- 이름이 "ids", "mask" 및 "segment_ids"인 kTfLiteString 유형의 입력 텐서 3개.
- Wordpiece/Sentencepiece Tokenizer용 input_process_units
- kTfLiteFloat32 유형의 정확히 하나의 출력 텐서
- 입력 텐서 1개.
- RegexTokenizer Tokenizer용 input_process_units
- kTfLiteFloat32 유형의 정확히 하나의 출력 텐서
- 이름이 "inp_text", "res_context" 및 "res_text"인 입력 텐서 3개
- kTfLiteFloat32 유형의 이름이 "query_encoding" 및 "response_encoding"인 출력 텐서 2개
TODO(b/180502532): 예제 모델에 포인터를 추가합니다.
TODO(b/222671076): 단일 파일 형식(모델에 압축된 인덱스 파일)이 지원되면 `createFromFile`과 같은 옵션 없이 팩토리 생성 메서드를 추가합니다.
중첩 클래스
수업 | TextSearcher.TextSearcher옵션 | TextSearcher 설정 옵션. |
공개 방법
정적 TextSearcher | createFromBufferAndOptions ( ByteBuffer modelBuffer, TextSearcher.TextSearcherOptions 옵션) 모델 버퍼와 TextSearcher.TextSearcherOptions 사용하여 TextSearcher 인스턴스를 만듭니다. |
정적 TextSearcher | createFromBufferAndOptionsImpl ( ByteBuffer modelBuffer, TextSearcher.TextSearcherOptions 옵션, int indexFd) |
정적 TextSearcher | |
정적 TextSearcher | createFromFileAndOptions (컨텍스트 컨텍스트, 문자열 modelPath, TextSearcher.TextSearcherOptions 옵션) TextSearcher.TextSearcherOptions 에서 TextSearcher 인스턴스를 만듭니다. |
목록 < 가장 가까운 이웃 > |
상속된 메서드
공개 방법
공개 정적 TextSearcher createFromBufferAndOptions ( ByteBuffer modelBuffer, TextSearcher.TextSearcherOptions 옵션)
모델 버퍼와 TextSearcher.TextSearcherOptions
사용하여 TextSearcher
인스턴스를 만듭니다.
매개변수
모델버퍼 | 검색 모델의 직접 ByteBuffer 또는 MappedByteBuffer |
---|---|
옵션 |
던지기
IllegalArgumentException | 모델 버퍼가 직접 ByteBuffer 또는 MappedByteBuffer 가 아닌 경우 |
---|---|
IO예외 | 인덱스 파일을 로드할 때 I/O 오류가 발생하는 경우 |
IllegalStateException | 내부 오류가 있는 경우 |
런타임예외 | 달리 명시되지 않은 오류가 있는 경우 |
공개 정적 TextSearcher createFromBufferAndOptionsImpl ( ByteBuffer modelBuffer, TextSearcher.TextSearcherOptions 옵션, int indexFd)
매개변수
모델버퍼 | |
---|---|
옵션 | |
indexFd |
공개 정적 TextSearcher createFromFileAndOptions ( 파일 모델파일, TextSearcher.TextSearcherOptions 옵션)
TextSearcher
인스턴스를 만듭니다.
매개변수
모델파일 | 검색 모델 File 인스턴스 |
---|---|
옵션 |
던지기
IO예외 | tflite 모델이나 인덱스 파일을 로드할 때 I/O 오류가 발생하는 경우 |
---|---|
IllegalArgumentException | 인수가 유효하지 않은 경우 |
IllegalStateException | 내부 오류가 있는 경우 |
런타임예외 | 달리 명시되지 않은 오류가 있는 경우 |
public static TextSearcher createFromFileAndOptions (컨텍스트 컨텍스트, 문자열 modelPath, TextSearcher.TextSearcherOptions 옵션)
TextSearcher.TextSearcherOptions
에서 TextSearcher
인스턴스를 만듭니다.
매개변수
문맥 | |
---|---|
모델경로 | 자산의 메타데이터가 있는 검색 모델의 경로 |
옵션 |
던지기
IO예외 | tflite 모델이나 인덱스 파일을 로드할 때 I/O 오류가 발생하는 경우 |
---|---|
IllegalArgumentException | 인수가 유효하지 않은 경우 |
IllegalStateException | 내부 오류가 있는 경우 |
런타임예외 | 달리 명시되지 않은 오류가 있는 경우 |
공개 목록 < NearestNeighbor > 검색 ( 문자열 텍스트)
제공된 문자열 입력에 대해 임베딩 추출을 수행한 후 인덱스에서 가장 가까운 이웃 검색을 수행합니다.
매개변수
텍스트 | 모델에 텍스트 쿼리 입력 |
---|