小编skb*_*hmn的帖子

Alexa Intent Schema:随机输入被识别为意图

我有两个使用相同插槽类型的意图.但是,如果输入是随机字符串,则Alexa会自动识别其JSON请求中的意图,即使它不是话语的一部分.例如,在下面的示例中,如果用户输入为'bla bla bla',则将其GetAccountBalance标识为没有插槽值的intent,即使它不是提供的话语的一部分.

对这些情况进行错误检查的方法是什么?在开发意图模式时,避免这种情况的最佳做法是什么?有没有办法创建一个可以处理所有随机输入的意图?

示例架构:

{
  "intents": [
    {
      "intent": "GetAccountBalance",
      "slots": [
        {
          "name": "AccountType",
          "type": "ACCOUNT_TYPE"
        }
      ]
    },
    {
      "intent": "GetAccountNumber",
      "slots": [
        {
          "name": "AccountType",
          "type": "ACCOUNT_TYPE"
        }
      ]
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

话语:

GetAccountBalance what is my account balance for {AccountType} Account
GetAccountBalance what is my balance for {AccountType} Account
GetAccountBalance what is the balance for my {AccountType} Account
GetAccountBalance what is {AccountType} account balance
GetAccountBalance what is my account balance
GetAccountBalance what is …
Run Code Online (Sandbox Code Playgroud)

alexa alexa-skill alexa-skills-kit alexa-voice-service

7
推荐指数
1
解决办法
1991
查看次数

推送到远程分支(无法更新ref)

我有一个带功能/初始更改分支的远程存储库.现在我想从我的本地feature/initital-change分支将一些文件推送到这个远程分支.

我通过几个帖子推送到远程分支并尝试了一些方法,但我仍然得到同样的错误.添加和提交后,我得到以下git状态.

Sakibs-MacBook-Pro:BluFireLabs SakibArRahman$ git status
On branch feature/initial-change
Your branch is ahead of 'origin/feature/initial-change' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)

但是当我推动时,我会得到以下结果:

Sakibs-MacBook-Pro:BluFireLabs SakibArRahman$ git push origin feature/initial-change
Counting objects: 255, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (141/141), done.
Writing objects: 100% (255/255), 6.57 MiB | 1.88 MiB/s, done.
Total 255 (delta 49), reused 13 (delta 5)
remote: error: Cannot update the ref 'refs/heads/feature/initial-change': …
Run Code Online (Sandbox Code Playgroud)

git branch push repository bitbucket

5
推荐指数
1
解决办法
6925
查看次数

boto3 从客户端获取资源

适用于 python 的 AWS 库 (boto) 有两种不同类型的接口用于与 AWS 配合使用,低级别client和更高级别的更 pythonic resource

我的代码的一部分使用一个,而其他部分使用另一个。

从文档中可以找到client从 a 中获取 a resource

# Create the resource
sqs_resource = boto3.resource('sqs')

# Get the client from the resource
sqs = sqs_resource.meta.client
Run Code Online (Sandbox Code Playgroud)

我的问题是如果有客户sqs,我如何从中获得boto3.resource

(我不能简单地调用,boto3.resource('sqs')因为客户端有其他东西,例如已经附加到它的凭证,出于某种设计原因,资源试图从一堆我不想要的地方获取 AWS 凭证,我'我希望它使用客户端上设置的任何凭据/帐户)

python amazon-web-services boto3

5
推荐指数
1
解决办法
5324
查看次数

如何迭代 sqlite 中嵌套 json 对象中的数组?

假设我有一个 sqlite 表features,其中有一列data包含 json 对象。

CREATE TABLE features ( id INTEGER PRIMARY KEY, data json )

现在,示例数据对象可能是:

{"A":
   {"B":
      {"coordinates":[
         {"x":1, "y":10},
         {"x":10, "y":2},
         {"x":12, "y":12}
       ]
    }
}
Run Code Online (Sandbox Code Playgroud)

现在,数组中 json 对象的数量coordinates可以随行而变化。有些文档可以有 3 个坐标(上面的示例),而其他文档可能有 5 个或更多坐标。

对于每一行或文档,我希望能够仅迭代x值并找到最小值,对于y值也是如此。因此,该示例的结果对于 x 来说是 1,对于 y 来说是 2。

我可以使用数组内的所有 json 对象json_each,但无法仅提取一行的 x 。我试过:

select value from features, json_each(json_extract(features.data, '$.A.B.coordinates'));
Run Code Online (Sandbox Code Playgroud)

但是,这似乎返回coordinate所有行的“所有”json 对象。如何迭代一个文档的数组并从中提取值,以便我可以为一个文档选择最小值或最大值?

arrays sqlite json

4
推荐指数
1
解决办法
1373
查看次数

使用 Espresso 在 ViewPager 中查找视图(AmbiguousViewMatcherException)

我有一个 ViewPager,它一次只在屏幕上显示一个片段。该片段有一个 recyclerView,其中填充了由一个图像和两个 textView 组成的列表项。我需要选择项目并根据显示的文本执行单击。

我的 viewPage 有 Id pager,recyclerView 是listview,我正在使用 cardView 小部件,它有一个名为的相对布局cardContainer,其中有一个nickNname我感兴趣的 textView 。

Espresso 似乎只能识别pager但在视图层次结构中找不到任何其他 Id。我如何访问nickName或基本上访问viewPager 或片段中的任何其他视图?

我尝试了以下方法:

        ViewInteraction listviewInteraction = onView (allOf(withId(R.id.pager)));
    listviewInteraction.check(matches(hasDescendant(withId(R.id.listview))));
Run Code Online (Sandbox Code Playgroud)

我收到以下错误,因为寻呼机没有任何孩子

    Expected: has descendant: with id: 2131689666
Got: "ViewPager{id=2131689659, res-name=pager, visibility=VISIBLE, width=1080, height=1533, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=144.0, child-count=0}"
Run Code Online (Sandbox Code Playgroud)

我还尝试了几种不同的方法,类似于此处发布的方法,但 Espresso 找不到listviewnickname

我怎样才能找到视图nickName

更新:

我又运行了一些测试,当 Espresso 运行测试时,viewPager …

android listview android-fragments android-viewpager android-espresso

1
推荐指数
1
解决办法
2459
查看次数