RegExpRecognizer class
정규식을 사용하여 사용자 의도를 검색하는 의도 인식기 플러그 인입니다. 여러 언어에서 인식할 수 있도록 여러 식을 전달할 수 있습니다.
- Extends
생성자
| Reg |
인식기의 새 인스턴스를 생성합니다. |
메서드
| on |
인식기를 조건부로 사용하거나 사용하지 않도록 설정하는 함수를 등록합니다. 여러 처리기를 등록할 수 있으며 다른 처리기 전에 새 처리기가 실행됩니다. |
| on |
인식기에서 출력을 필터링하는 함수를 등록합니다. 여러 처리기를 등록할 수 있으며 다른 처리기 후에 새 처리기가 실행됩니다. |
| on |
실제 인식 논리를 구현합니다. |
| recognize(IRecognize |
사용자 텍스트 발화를 의도와 일치시키려고 시도합니다. |
생성자 세부 정보
RegExpRecognizer(string, RegExp | IRegExpMap)
인식기의 새 인스턴스를 생성합니다.
new RegExpRecognizer(intent: string, expressions: RegExp | IRegExpMap)
매개 변수
- intent
-
string
식이 일치할 때 반환할 의도의 이름입니다.
- expressions
-
RegExp | IRegExpMap
모든 발화에 사용되는 개별 식 또는 발화의 로캘에 따라 조건부로 사용되는 로캘별 식의 맵입니다.
메서드 세부 정보
onEnabled((context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void)
인식기를 조건부로 사용하거나 사용하지 않도록 설정하는 함수를 등록합니다. 여러 처리기를 등록할 수 있으며 다른 처리기 전에 새 처리기가 실행됩니다.
function onEnabled(handler: (context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void)
매개 변수
- handler
-
(context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void
모든 메시지에 대해 호출된 함수입니다. 인식해야 하는 모든 메시지에 대해 callback(null, true) 호출해야 합니다.
반환
onFilter((context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void)
인식기에서 출력을 필터링하는 함수를 등록합니다. 여러 처리기를 등록할 수 있으며 다른 처리기 후에 새 처리기가 실행됩니다.
function onFilter(handler: (context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void)
매개 변수
- handler
-
(context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void
함수는 점수가 0.0보다 큰 의도를 생성하는 모든 메시지에 대해 호출됩니다.
callback(null, { score: 0.0, intent: null }) 호출하여 의도가 반환되지 않도록 차단해야 합니다.
반환
onRecognize(IRecognizeContext, (err: Error, result: IIntentRecognizerResult) => void)
실제 인식 논리를 구현합니다.
function onRecognize(context: IRecognizeContext, callback: (err: Error, result: IIntentRecognizerResult) => void)
매개 변수
- context
- IRecognizeContext
- callback
-
(err: Error, result: IIntentRecognizerResult) => void
recognize(IRecognizeContext, (err: Error, result: IIntentRecognizerResult) => void)
사용자 텍스트 발화를 의도와 일치시키려고 시도합니다.
function recognize(context: IRecognizeContext, callback: (err: Error, result: IIntentRecognizerResult) => void)
매개 변수
- context
- IRecognizeContext
인식되는 수신된 메시지에 대한 컨텍스트 정보입니다.
- callback
-
(err: Error, result: IIntentRecognizerResult) => void
인식 작업의 결과를 사용하여 호출하는 함수입니다.