当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript EntityRecognizer.findEntity方法代码示例

本文整理汇总了TypeScript中botbuilder.EntityRecognizer.findEntity方法的典型用法代码示例。如果您正苦于以下问题:TypeScript EntityRecognizer.findEntity方法的具体用法?TypeScript EntityRecognizer.findEntity怎么用?TypeScript EntityRecognizer.findEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在botbuilder.EntityRecognizer的用法示例。


在下文中一共展示了EntityRecognizer.findEntity方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

    (session: builder.Session, args: any, next?: (results?: builder.IDialogResult<any>) => void) => {
        let place: IStoredData;
        let heathplace: boolean = false

        if (args && args.intent) {
            let intent = args.intent;
            // Get Place.Type and Place.Location entities
            let typeEntity: IEntityEx = builder.EntityRecognizer.findEntity(intent.entities, 'Place.Type') as IEntityEx;
            let locationEntity: IEntityEx = builder.EntityRecognizer.findEntity(intent.entities, 'Place.Location') as IEntityEx;

            place = session.dialogData.place = {
                type: typeEntity ? typeEntity.resolution.values[0] : undefined,
                location: locationEntity ? locationEntity.entity : undefined,
            };

            // We want to manage only medical places
            heathplace = place.type == 'hospital' || place.type == 'pharmacy';
        }

        if (!heathplace) {
            builder.Prompts.choice(session, "choice_prompt", "hospital|pharmacy", { listStyle: ListStyle.button });
        }
        else {
            if (next) return next();
        }
    },
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:26,代码来源:findplace-dialog.ts

示例2: processLanguage

    private processLanguage(session: Session, args, next) {
		console.log('processing language');
        var name = EntityRecognizer.findEntity(args.entities, 'CharacterName');
        var realm = EntityRecognizer.findEntity(args.entities, 'RealmName');
        
        var charData = session.dialogData.character = {
            name: name && name.entity,
            realm: realm && realm.entity
        };
        
        if (!charData.name) {
            Prompts.text(session, "What is the name of the character?");
        } else {
            next();
        }  
    }
开发者ID:DHainzl,项目名称:ILvlBot,代码行数:16,代码来源:ILvlBot.ts

示例3: if

                 (session: any, args: any, next: any) => {
                    var brand = builder.EntityRecognizer.findEntity(args.entities, 'PcBrand');
                    var type = builder.EntityRecognizer.findEntity(args.entities, 'PcType');
                    var price: any = {
                        'price' :  builder.EntityRecognizer.findEntity(args.entities, 'PcPrice'),
                        'startPrice' : builder.EntityRecognizer.findEntity(args.entities, 'PcPrice::startPrice'),
                        'endPrice' : builder.EntityRecognizer.findEntity(args.entities, 'PcPrice::endPrice')
                    };

                    var cam: any = null;

                    if (builder.EntityRecognizer.findEntity(args.entities, 'PcCam::With')) {
                        cam = true;
                    } else if (builder.EntityRecognizer.findEntity(args.entities, 'PcCam::Without')) {
                        cam = false;
                    }

                    var got_price: any = null;

                    for (var key in price) {
                        if (price[key]) {
                            got_price = true;
                            price[key] = price[key].entity;
                        }
                    }

                    session.userData.profile = {
                        brand: brand ? brand.entity : null,
                        type: type ? type.entity : null,
                        price: got_price ? price : null,
                        cam: cam
                    };

                    next();
                },
开发者ID:DXFrance,项目名称:botretail,代码行数:35,代码来源:retailbot.dialogsManager.ts

示例4: function

 function(session, args, next) {
     console.log("args :: \n" + JSON.stringify(args.entities));
     var symbol = builder.EntityRecognizer.findEntity(args.entities, 'company');
     if (!symbol) {
         builder.Prompts.text(session, "Which company stock you are intrested in?");
     } else {
         next({ response: symbol.entity });
     }
 },
开发者ID:plkumar,项目名称:StockBot,代码行数:9,代码来源:server.ts

示例5: next

 (session: Session, luisResults: IIntentRecognizerResult, next: (results?: IDialogResult<any>) => void) => {
     const languageEntity = EntityRecognizer.findEntity(luisResults.entities, 'language');
     const language = languageEntity && languageEntity.entity;
     if (!language) {
         Prompts.choice(session, 'master.languageSelection', Object.keys(languages),
             { listStyle: ListStyle.button, maxRetries: 3, retryPrompt: 'master.retryLanguageSelection' });
     } else {
         next({ response: { entity: language }});
     }
 },
开发者ID:magencio,项目名称:UberBotNode_V3,代码行数:10,代码来源:masterDialog.ts

示例6: async

    async (session: builder.Session, args: any, next?: (results?: builder.IDialogResult<any>) => void) => {
        let data: IInformationStoredData | undefined = undefined;

        // Get the Medication entity
        if (args && args.intent) {
            let intent = args.intent;
            let medicationEntity: IEntityEx = builder.EntityRecognizer.findEntity(intent.entities, 'Medication.Name') as IEntityEx;
            let typeEntity: IEntityEx = builder.EntityRecognizer.findEntity(intent.entities, 'Medication.Type') as IEntityEx;

            data = session.dialogData.drug = {
                name: medicationEntity ? medicationEntity.entity : undefined,
                type: typeEntity ? typeEntity.resolution : undefined
            }
        }

        if (data && data.name) {
            if (next) return next();
        }
        else {
            session.send("drugs_help_tip_image");
            return builder.Prompts.text(session, "medication_prompt")
        }
    },
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:23,代码来源:medication-dialog.ts

示例7: function

 builder.LuisDialog.recognize(session.message.text, modelUri, function (err, intents, entities) {
     if (null != err) {
         session.endDialog("Unexpected error while parsing your answer. Try again after sometime!");
         return;
     }
     session.userData.nameAlreadyAsked = true;
     var entity = builder.EntityRecognizer.findEntity(entities, 'name');
     if (null != entity) {
         session.userData.name = entity.entity;
         session.beginDialog("/showOffer");
     }
     else {
         session.send("I am sorry, i did not understand your answser. Please provide your name again.");
         //session.replaceDialog("/userProfile");
     }
 });
开发者ID:giriganapathy,项目名称:VZChatBotApp,代码行数:16,代码来源:server.ts

示例8: function

    function (session, args) {
        //session.userData.selectedPackageName = "Custom TV Essentials";
        //session.send("From:" + session.message.from.channelId);
        var entity = builder.EntityRecognizer.findEntity(args.entities, 'tv-package-name');
        if (null != entity) {
            var tvPackageName = entity.entity;
            if (null != tvPackageName) {
                tvPackageName = tvPackageName.replace(/\s+/g, '');
                if (session.userData.selectedPackageName != fiosTVPackages[tvPackageName]) {
                    session.userData.selectedPackageName = fiosTVPackages[tvPackageName];
                    //session.send("Your current selection: " + session.userData.selectedPackageName);

                    var packageInfo = "Your current selection: " + session.userData.selectedPackageName;
                    builder.Prompts.confirm(session, packageInfo + "<br/>Are you looking for any specific channels in your package?");
                }
            }
        }
    },
开发者ID:giriganapathy,项目名称:FiOSPackageHelper,代码行数:18,代码来源:server.ts


注:本文中的botbuilder.EntityRecognizer.findEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。