This repository was archived by the owner on Apr 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
packages/jovo-model-nlpjs/src Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -16,5 +16,5 @@ export interface NlpjsModelFile {
16
16
name : string ;
17
17
locale : string ;
18
18
data : NlpjsData [ ] ;
19
- entities ?: Record < string , NlpjsEntity > ;
19
+ entities ?: Record < string , NlpjsEntity | string > ;
20
20
}
Original file line number Diff line number Diff line change 8
8
} from '@jovotech/model' ;
9
9
import { NlpjsData , NlpjsModelFile } from '.' ;
10
10
11
+ const REGEX_PREFIX = 'regex:' ;
12
+
11
13
export class JovoModelNlpjs extends JovoModel {
12
14
static MODEL_KEY = 'nlpjs' ;
13
15
@@ -87,6 +89,12 @@ export class JovoModelNlpjs extends JovoModel {
87
89
if ( JovoModelHelper . hasEntityTypes ( model ) ) {
88
90
returnData . entities = { } ;
89
91
for ( const [ entityKey , entityTypeName ] of Object . entries ( entitiesMap ) ) {
92
+
93
+ if ( entityTypeName . startsWith ( REGEX_PREFIX ) ) {
94
+ returnData . entities ! [ entityKey ] = entityTypeName . slice ( REGEX_PREFIX . length ) ;
95
+ continue ;
96
+ }
97
+
90
98
const relatedEntityType = JovoModelHelper . getEntityTypeByName ( model , entityTypeName ) ;
91
99
if ( ! relatedEntityType ?. values ?. length ) {
92
100
continue ;
You can’t perform that action at this time.
0 commit comments