{"id":14953,"date":"2021-05-07T20:20:25","date_gmt":"2021-05-07T11:20:25","guid":{"rendered":"https:\/\/itport.cloud\/?p=14953"},"modified":"2021-05-07T20:20:26","modified_gmt":"2021-05-07T11:20:26","slug":"post-14953","status":"publish","type":"post","link":"https:\/\/itport.cloud\/?p=14953","title":{"rendered":"\uff08\u6700\u7d42\u56de\uff09Amazon Lex\u3092\u4f7f\u3063\u3066\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff5eLambda\u306e\u51e6\u7406\u3092\u3044\u308d\u3044\u308d\u5909\u66f4\u3057\u3066\u307f\u308b\uff5e"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"mce_1\">\u76ee\u6b21<\/h2>\n\n\n\n<p><a href=\"#Al_2\">\u524d\u56de\u306e\u304a\u3055\u3089\u3044<\/a><br><a href=\"#Al_3\">lambda\u306e\u4e2d\u8eab\u3092\u898b\u3066\u307f\u308b\u2460\u6ce8\u6587\u306e\u7a2e\u985e<\/a><br><a href=\"#Al_4\">lambda\u306e\u4e2d\u8eab\u3092\u898b\u3066\u307f\u308b\u2461\u65e5\u4ed8\u306e\u5224\u5225<\/a><br><a href=\"#Al_5\">\u307e\u3068\u3081<\/a><br><a href=\"#Al_6\">\u6700\u5f8c\u306b<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Al_2\">\u524d\u56de\u306e\u304a\u3055\u3089\u3044<\/h2>\n\n\n\n<p> \u524d\u56de\u306f\u3001\u30c6\u30ad\u30b9\u30c8\u3084\u97f3\u58f0\u3067\u306e\u5165\u529b\u3067\u306f\u306a\u304f\u3001\u30dc\u30bf\u30f3\u5165\u529b\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3084\u3001lambda\u3092\u4f7f\u3063\u3066\u52d5\u7684\u306b\u8fd4\u7b54\u3092\u8fd4\u3059\u3088\u3046\u306b\u3059\u308b\u65b9\u6cd5\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3084\u306f\u308a\u89e6\u3063\u3066\u307f\u3066\u611f\u3058\u308b\u3053\u3068\u306f\u3001\u6a19\u6e96\u306eGUI\u3067\u64cd\u4f5c\u3067\u304d\u308b\u90e8\u5206\u306f\u5236\u9650\u304c\u3042\u308a\u3001\u304b\u3064\u5b66\u7fd2\u30b3\u30b9\u30c8\u3082\u9ad8\u305d\u3046\u306a\u306e\u3067\u3001\u7d50\u5c40\u306flambda\u3067\u6700\u521d\u304b\u3089\u66f8\u3044\u3066\u3044\u304f\u306e\u304c\u826f\u3044\u306e\u304b\u306a\u3001\u3068\u3044\u3046\u5370\u8c61\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u524d\u56de\u306f\u3055\u3089\u3063\u3068\u6d41\u3059\u7a0b\u5ea6\u3067\u3057\u304b\u89e6\u3089\u306a\u304b\u3063\u305flambda\u3068\u306e\u9023\u643a\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u305d\u3053\u3092\u4e2d\u5fc3\u3067\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Al_3\">lambda\u3092\u898b\u3066\u307f\u308b\u2460\u6ce8\u6587\u306e\u7a2e\u985e<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"406\" height=\"363\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image.png\" alt=\"\" class=\"wp-image-14955\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image.png 406w, https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-300x268.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-358x320.png 358w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/figure>\n\n\n\n<p>rose\u3060\u3068\u306a\u3044\u3068\u8a00\u308f\u308c\u308b\u3051\u3069\u3001roses\u3060\u3068\u300c\u3044\u3064\u3068\u308a\u306b\u304f\u308b\uff1f\u300d\u3068\u4f1a\u8a71\u304c\u9032\u3080\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ndef validate_order_flowers(flower_type, date, pickup_time):\n     flower_types = &#x5B;'lilies', 'roses', 'tulips']\n     if flower_type is not None and flower_type.lower() not in flower_types:\n         return build_validation_result(False,\n                                        'FlowerType',\n                                        'We do not have {}, would you like a different type of flower?  '\n                                        'Our most popular flowers are roses'.format(flower_type))\n<\/pre><\/div>\n\n\n<p>flower_types = [&#8216;lilies&#8217;, &#8216;roses&#8217;, &#8216;tulips&#8217;] <br>\u3053\u306e\u914d\u5217\u306b\u5165\u3063\u3066\u3044\u308b\u304b\u5426\u304b\u3067\u5224\u5225\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u3053\u306b\u597d\u304d\u306a\u3082\u306e\u3092\u5165\u308c\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u524d\u56de\u304b\u3089\u540c\u69d8\u306bAmazonLex\u304c\u307e\u3060\u65e5\u672c\u8a9e\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u82f1\u8a9e\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>flower_types = [&#8216;lilies&#8217;, &#8216;roses&#8217;,&#8217;rose&#8217;, &#8216;tulips&#8217;] <br>\u3053\u3093\u306a\u98a8\u306b\u8ffd\u52a0\u3059\u308b\u3068\u6b21\u306e\u3088\u3046\u306brose\u3067\u3082\u4f1a\u8a71\u304c\u7d9a\u304f\u306e\u3067\u5019\u88dc\u306f\u5168\u3066\u5b9a\u7fa9\u3059\u308b\u304b\u3001\u90e8\u5206\u4e00\u81f4\u306b\u3059\u308b\u306e\u304c\u826f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3001\u90e8\u5206\u4e00\u81f4\u306b\u3059\u308b\u3068\u304b\u306a\u308a\u77ed\u3044\u5358\u8a9e\u3067\u56de\u7b54\u3055\u308c\u305f\u6642\u306b\u5f15\u3063\u304b\u304b\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u5168\u3066\u5b9a\u7fa9\u3059\u308b\u65b9\u304c\u3088\u3055\u305d\u3046\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001\u300cRose\u300d\u3067\u306f\u306a\u304f\u300cRo\u300d\u3068\u304b\u8a00\u308f\u308c\u305f\u6642\u3082\u53cd\u5fdc\u3057\u3066\u3057\u307e\u3046\u306e\u306fNG\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"212\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-1.png\" alt=\"\" class=\"wp-image-14956\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-1.png 400w, https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-1-300x159.png 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Al_4\">lambda\u3092\u898b\u3066\u307f\u308b\u2461\u65e5\u4ed8\u306e\u5224\u5225<\/h2>\n\n\n\n<p> \u6b21\u306b\u65e5\u4ed8\u306e\u8003\u616e\u306e\u90e8\u5206\u3067\u3059\u3002<br>\u4ee5\u4e0b\u306e\u90e8\u5206\u304c\u3001\u300c\u3044\u3064\u53d6\u308a\u306b\u304f\u308b\u306e\uff1f\u300d\u300c\u4eca\u65e5\u300d\u300c\u660e\u65e5\u4ee5\u964d\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u300d\u3068\u3044\u3046\u90e8\u5206\u3067\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nif date is not None:\n    if not isvalid_date(date):\n        return build_validation_result(False, 'PickupDate', 'I did not understand that, what date would you like to pick the flowers up?')\n    elif datetime.datetime.strptime(date, '%Y-%m-%d').date() <= datetime.date.today():\n        return build_validation_result(False, 'PickupDate', 'You can pick up the flowers from tomorrow onwards.  What day would you like to pick them up?')\n\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"418\" height=\"255\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-2.png\" alt=\"\" class=\"wp-image-14957\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-2.png 418w, https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-2-300x183.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-2-250x154.png 250w\" sizes=\"auto, (max-width: 418px) 100vw, 418px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>\u300c\u4eca\u65e5\u884c\u304d\u307e\u3059\u300d\u300c\u660e\u65e5\u4ee5\u964d\u306b\u3057\u3066\u300d<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nelif datetime.datetime.strptime(date, '%Y-%m-%d').date() <= datetime.date.today():\n         return build_validation_result(False, 'PickupDate', 'You can pick up the flowers from tomorrow onwards.  What day would you like to pick them up?')\n<\/pre><\/div>\n\n\n<p>\u3053\u306e\u90e8\u5206\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nelif datetime.datetime.strptime(date, '%Y-%m-%d').date() <= datetime.date.today() + datetime.timedelta(days=1):\n         return build_validation_result(False, 'PickupDate', 'You can pick up the flowers from two day after onwards.  What day would you like to pick them up?')\n<\/pre><\/div>\n\n\n<p>\u3053\u308c\u3067\u300c\u660e\u65e5\u300d\u3068\u56de\u7b54\u3057\u3066\u3082\u300c\uff12\u65e5\u5f8c\u4ee5\u964d\u306b\u3057\u3066\u300d\u3068\u3044\u3046\u98a8\u306b\u304b\u308f\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"418\" height=\"222\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-3.png\" alt=\"\" class=\"wp-image-14958\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-3.png 418w, https:\/\/itport.cloud\/wp-content\/uploads\/2021\/05\/image-3-300x159.png 300w\" sizes=\"auto, (max-width: 418px) 100vw, 418px\" \/><\/figure>\n\n\n\n<p>lambda\u3092\u89e6\u3063\u3066\u3044\u3066\u6c17\u304c\u4ed8\u3044\u305f\u306e\u3067\u3059\u304c\u3001lambda\u306f\u30c7\u30d7\u30ed\u30a4\u306e\u6642\u9593\u304c\u4e00\u77ac\u306a\u306e\u3067\u3001\u3084\u306f\u308alambda\u306b\u5168\u3066\u4efb\u305b\u308b\u65b9\u304c\u52b9\u7387\u304c\u3088\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>Amazon Lex\u5074\u306f\u4f55\u304b\u5909\u66f4\u3057\u3066\u30d3\u30eb\u30c9\u3059\u308b\u307e\u3067\u7d50\u69cb\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Al_5\">\u307e\u3068\u3081<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u30b7\u30f3\u30d7\u30eb\u306a\u30c1\u30e3\u30c3\u30c8\u30dc\u30c3\u30c8\u3067\u3042\u308c\u3070\u3001Amazon Lex\u5074\u306eGUI\u306e\u64cd\u4f5c\u3067\u4f5c\u6210\u53ef\u80fd<\/li><li>\u6761\u4ef6\u5206\u5c90\u306a\u3069\u4ed8\u3051\u305f\u3044\u3068\u304d\u306f\u3001\u5168\u3066\u3092lamdba\u306b\u4efb\u305b\u308b\u65b9\u304c\u52b9\u7387\u304c\u826f\u3044<\/li><li>lambda\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u90e8\u5206\u7684\u306b\u6d41\u7528\u3057\u3066\u3044\u3051\u3070Python\u3092\u4e00\u304b\u3089\u66f8\u304f\u5fc5\u8981\u306f\u306a\u3044<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Al_6\">\u6700\u5f8c\u306b<\/h2>\n\n\n\n<p>\u3044\u304b\u304c\u3067\u3057\u305f\u3067\u3057\u3087\u3046\u304b\u3002\u5168\u56db\u56de\u3067GUI\u3067\u30dd\u30c1\u30dd\u30c1\u4f5c\u3063\u3066\u307f\u308b\u90e8\u5206\u304b\u3089\u5168\u3066Python\u306b\u4efb\u305b\u308b\u65b9\u6cd5\u307e\u3067\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002\u6b21\u306f\u4f55\u304b\u5b9f\u904b\u7528\u3067\u4f7f\u3048\u305d\u3046\u306a\u3082\u306e\u304c\u51fa\u6765\u305f\u3089\u3054\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br>\u6599\u91d1\u7684\u306b\u306f\u3001\u6700\u521d\u306e\u4e00\u5e74\u306f\u8a66\u7528\u304c\u51fa\u6765\u307e\u3059\u306e\u3067\u662f\u975e\u6c17\u8efd\u306b\u8a66\u3057\u3066\u307f\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002\uff08\u203b\u4ee5\u4e0b\u306e\u629c\u7c8b\u3092\u53c2\u7167\uff09<\/p>\n\n\n\n<p> Amazon Lex \u306f\u7121\u6599\u3067\u8a66\u7528\u3067\u304d\u307e\u3059\u3002Amazon Lex \u306e\u4f7f\u7528\u3092\u958b\u59cb\u3057\u305f\u65e5\u304b\u3089\u6700\u521d\u306e 1 \u5e74\u9593\u306f\u30011 \u304b\u6708\u3042\u305f\u308a\u6700\u5927\u3067 10,000 \u56de\u306e\u30c6\u30ad\u30b9\u30c8\u30ea\u30af\u30a8\u30b9\u30c8\u3068 5,000 \u56de\u306e\u97f3\u58f0\u30ea\u30af\u30a8\u30b9\u30c8\u307e\u305f\u306f\u97f3\u58f0\u9593\u9694\u3092\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 <br>\u203b2021\u5e745\u67086\u65e5\u6642\u70b9<\/p>\n","protected":false},"excerpt":{"rendered":"\u76ee\u6b21 \u524d\u56de\u306e\u304a\u3055\u3089\u3044lambda\u306e\u4e2d\u8eab\u3092\u898b\u3066\u307f\u308b\u2460\u6ce8\u6587\u306e\u7a2e\u985elambda\u306e\u4e2d\u8eab\u3092\u898b\u3066\u307f\u308b\u2461\u65e5\u4ed8\u306e\u5224\u5225\u307e\u3068\u3081\u6700\u5f8c\u306b \u524d\u56de\u306e\u304a\u3055\u3089\u3044 \u524d\u56de\u306f\u3001\u30c6\u30ad\u30b9\u30c8\u3084\u97f3\u58f0\u3067\u306e\u5165\u529b\u3067\u306f\u306a\u304f\u3001\u30dc\u30bf\u30f3\u5165\u529b\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3084\u3001lambda\u3092\u4f7f\u3063\u3066\u52d5\u7684\u306b\u8fd4\u7b54\u3092\u8fd4\u3059\u3088\u3046\u306b\u3059\u308b\u65b9\u6cd5\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u3084\u306f\u308a\u89e6\u3063\u3066\u307f\u3066\u611f\u3058\u308b\u3053\u3068\u306f\u3001\u6a19\u6e96\u306eGUI\u3067\u64cd\u4f5c\u3067\u304d\u308b\u90e8\u5206\u306f\u5236\u9650\u304c\u3042\u308a\u3001\u304b\u3064\u5b66\u7fd2\u30b3\u30b9\u30c8\u3082\u9ad8\u305d\u3046\u306a\u306e\u3067\u3001\u7d50\u5c40\u306flambda\u3067\u6700\u521d\u304b\u3089\u66f8\u3044\u3066\u3044\u304f\u306e\u304c\u826f\u3044\u306e\u304b\u306a\u3001\u3068\u3044\u3046\u5370\u8c61\u3067\u3059\u3002 \u3068\u3044\u3046\u3053\u3068\u3067\u3001\u524d\u56de\u306f\u3055\u3089\u3063\u3068\u6d41\u3059\u7a0b\u5ea6\u3067\u3057\u304b\u89e6\u3089\u306a\u304b\u3063\u305flambda\u3068\u306e\u9023\u643a\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u305d\u3053\u3092\u4e2d\u5fc3\u3067\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 lambda\u3092\u898b\u3066\u307f\u308b\u2460\u6ce8\u6587\u306e\u7a2e\u985e rose\u3060\u3068\u306a\u3044\u3068\u8a00\u308f\u308c\u308b\u3051\u3069\u3001ro&hellip;","protected":false},"author":2,"featured_media":14969,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80],"tags":[81],"class_list":{"0":"post-14953","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-aws","8":"tag-season28"},"_links":{"self":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/14953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14953"}],"version-history":[{"count":10,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/14953\/revisions"}],"predecessor-version":[{"id":14976,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/14953\/revisions\/14976"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/media\/14969"}],"wp:attachment":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}