@@ -992,4 +992,48 @@ describe('luis:cross training tests among lu and qna contents', () => {
992992
993993 assert . equal ( luResult . get ( 'dia1' ) . Sections . filter ( s => s . SectionType !== sectionTypes . MODELINFOSECTION ) . length , 0 )
994994 } )
995+
996+ it ( 'luis:cross training can get expected result when handling brackets in qna question' , async ( ) => {
997+ let luContentArray = [ ]
998+ let qnaContentArray = [ ]
999+
1000+ luContentArray . push ( {
1001+ content :
1002+ `# dia1_trigger
1003+ - book a hotel for me` ,
1004+ id : 'main'
1005+ } )
1006+
1007+ qnaContentArray . push ( {
1008+ content :
1009+ `#? What does const [thing, setThing] = useState() mean?
1010+ - how to use it?
1011+ \`\`\`
1012+ Here is the [user guide](http://contoso.com/userguide.pdf)
1013+ \`\`\`` ,
1014+ id : 'main'
1015+ } )
1016+
1017+ let crossTrainConfig = {
1018+ 'main' : {
1019+ 'rootDialog' : true ,
1020+ 'triggers' : { }
1021+ }
1022+ }
1023+
1024+ const trainedResult = await crossTrainer . crossTrain ( luContentArray , qnaContentArray , crossTrainConfig )
1025+ const luResult = trainedResult . luResult
1026+ const qnaResult = trainedResult . qnaResult
1027+
1028+ let foundIndex = luResult . get ( 'main' ) . Sections . findIndex ( s => s . Name === 'DeferToRecognizer_QnA_main' )
1029+ assert . isTrue ( foundIndex > - 1 )
1030+ assert . equal ( luResult . get ( 'main' ) . Sections [ foundIndex ] . Body , `- how to use it?` )
1031+
1032+ foundIndex = qnaResult . get ( 'main' ) . Sections . findIndex ( s => s . Answer === 'intent=DeferToRecognizer_LUIS_main' )
1033+ assert . isTrue ( foundIndex > - 1 )
1034+ assert . equal ( qnaResult . get ( 'main' ) . Sections [ foundIndex ] . FilterPairs [ 0 ] . key , 'dialogName' )
1035+ assert . equal ( qnaResult . get ( 'main' ) . Sections [ foundIndex ] . FilterPairs [ 0 ] . value , 'main' )
1036+ assert . equal ( qnaResult . get ( 'main' ) . Sections [ foundIndex ] . Questions . length , 1 )
1037+ assert . equal ( qnaResult . get ( 'main' ) . Sections [ foundIndex ] . Questions [ 0 ] , 'book a hotel for me' )
1038+ } )
9951039} )
0 commit comments