@@ -975,4 +975,48 @@ describe('parseFile correctly parses utterances', function () {
975975 . catch ( err => done ( 'Fail!' ) )
976976
977977 } )
978+
979+ it ( 'duplicate utterances with entity labels are handled correctly' , function ( done ) {
980+ let testLU = `
981+ # test
982+ - no, i already have meeting {FromTime=3pm} {FromDate=tomorrow} afternoon
983+ - no, i already have meeting {FromTime=3pm} {FromDate=tomorrow} afternoon
984+ ` ;
985+ parseFile . parseFile ( testLU )
986+ . then ( res => {
987+ assert . equal ( res . LUISJsonStructure . utterances . length , 1 ) ;
988+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . text , "no, i already have meeting 3pm tomorrow afternoon" ) ;
989+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities . length , 2 ) ;
990+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 0 ] . entity , "FromTime" ) ;
991+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 0 ] . startPos , 27 ) ;
992+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 0 ] . endPos , 29 ) ;
993+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 1 ] . entity , "FromDate" ) ;
994+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 1 ] . startPos , 31 ) ;
995+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 1 ] . endPos , 38 ) ;
996+ done ( ) ;
997+ } )
998+ . catch ( err => done ( err ) )
999+ } )
1000+
1001+ it ( 'duplicate utterances with entity labels are handled correctly (partial)' , function ( done ) {
1002+ let testLU = `
1003+ # test
1004+ - no, i already have meeting {FromTime=3pm} tomorrow afternoon
1005+ - no, i already have meeting {FromTime=3pm} {FromDate=tomorrow} afternoon
1006+ ` ;
1007+ parseFile . parseFile ( testLU )
1008+ . then ( res => {
1009+ assert . equal ( res . LUISJsonStructure . utterances . length , 1 ) ;
1010+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . text , "no, i already have meeting 3pm tomorrow afternoon" ) ;
1011+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities . length , 2 ) ;
1012+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 0 ] . entity , "FromTime" ) ;
1013+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 0 ] . startPos , 27 ) ;
1014+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 0 ] . endPos , 29 ) ;
1015+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 1 ] . entity , "FromDate" ) ;
1016+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 1 ] . startPos , 31 ) ;
1017+ assert . equal ( res . LUISJsonStructure . utterances [ 0 ] . entities [ 1 ] . endPos , 38 ) ;
1018+ done ( ) ;
1019+ } )
1020+ . catch ( err => done ( err ) )
1021+ } )
9781022} )
0 commit comments