@@ -126,16 +126,13 @@ module.exports = {
126126 }
127127
128128 if ( LUISJSON . model_features && LUISJSON . model_features . length >= 0 ) {
129- fileContent += '> # Phrase list definitions' + NEWLINE + NEWLINE ;
130- LUISJSON . model_features . forEach ( function ( entity ) {
131- fileContent += `@ phraselist ${ entity . name } ${ ( entity . mode ? `(interchangeable)` : `` ) } ` ;
132- if ( entity . words && entity . words !== '' ) {
133- fileContent += ` = ${ NEWLINE } \t- ${ entity . words } ` ;
134- }
135- fileContent += NEWLINE + NEWLINE ;
136- } ) ;
137- fileContent += NEWLINE ;
129+ fileContent += handlePhraseLists ( LUISJSON . model_features ) ;
138130 }
131+
132+ if ( LUISJSON . phraselists && LUISJSON . phraselists . length >= 0 ) {
133+ fileContent += handlePhraseLists ( LUISJSON . phraselists ) ;
134+ }
135+
139136 if ( LUISJSON . closedLists && LUISJSON . closedLists . length >= 0 ) {
140137 fileContent += '> # List entities' + NEWLINE + NEWLINE ;
141138 LUISJSON . closedLists . forEach ( function ( ListItem ) {
@@ -188,6 +185,24 @@ module.exports = {
188185 return fileContent ;
189186 }
190187}
188+
189+ /**
190+ * Helper to handle phrase lists both in the new and old property.
191+ * @param {Object[] } collection
192+ */
193+ const handlePhraseLists = function ( collection ) {
194+ let fileContent = '> # Phrase list definitions' + NEWLINE + NEWLINE ;
195+ collection . forEach ( function ( entity ) {
196+ fileContent += `@ phraselist ${ entity . name } ${ ( entity . mode ? `(interchangeable)` : `` ) } ` ;
197+ if ( entity . words && entity . words !== '' ) {
198+ fileContent += ` = ${ NEWLINE } \t- ${ entity . words } ` ;
199+ }
200+ fileContent += NEWLINE + NEWLINE ;
201+ } ) ;
202+ fileContent += NEWLINE ;
203+
204+ return fileContent ;
205+ }
191206/**
192207 * Helper to add application inforamtion metadata
193208 * @param {Object } LUISJSON
@@ -234,7 +249,7 @@ const addNDepthChildDefinitions = function(childCollection, tabStop, fileContent
234249 myFileContent += addRolesAndFeatures ( child ) ;
235250 myFileContent += NEWLINE ;
236251 if ( child . children && child . children . length !== 0 ) {
237- myFileContent += addNDepthChildDefinitions ( child . children , ++ tabStop , myFileContent ) ;
252+ myFileContent += addNDepthChildDefinitions ( child . children , tabStop + 1 , myFileContent ) ;
238253 }
239254 } ) ;
240255 return myFileContent ;
0 commit comments