• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript botbuilder.EntityRecognizer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了EntityRecognizer类的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类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript botbuilder.Library类代码示例发布时间:2022-05-25
下一篇:
TypeScript botbuilder.DialogAction类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap