Is there a way to have change female to male voice during the conversation in DialogFlow (Api.ai) - voice

We a building a chatbot app for Google Home using Api.ai (Dialogflow now) which has both male and female historical figures. We are using Actions on google. Google lets you default to a male or female voice when deploying the app. Is there a way to switch between male to female voice dynamically, for example, using code in webhook?

Maybe. Although SSML supports a <voice> tag, the documentation for Actions does not list it as supported. However, as you noted, there appears to be some support. The gender and variant attributes seem to work, at least for en-US. The languages attribute doesn't seem to be. So something like this might work:
<speech>
<voice gender="male" variant="1">male</voice>
<voice gender="male" variant="2">male</voice>
<voice gender="female" variant="1">female</voice>
<voice gender="female" variant="2">female</voice>
</speech>
However what is documented as working is to adjust the pitch of the default voice (whichever one you pick) using the <prosody> SSML tag. Here is an example you can use to see how it sounds if you vary the pitch:
<speech>
test
<prosody pitch="-1st">test</prosody>
<prosody pitch="-2st">test</prosody>
<prosody pitch="-3st">test</prosody>
<prosody pitch="-4st">test</prosody>
<prosody pitch="-5st">test</prosody>
<prosody pitch="-6st">test</prosody>
<prosody pitch="-7st">test</prosody>
<prosody pitch="-8st">test</prosody>
<prosody pitch="-9st">test</prosody>
<prosody pitch="+1st">test</prosody>
<prosody pitch="+2st">test</prosody>
<prosody pitch="+3st">test</prosody>
<prosody pitch="+4st">test</prosody>
<prosody pitch="+5st">test</prosody>
<prosody pitch="+6st">test</prosody>
<prosody pitch="+7st">test</prosody>
<prosody pitch="+8st">test</prosody>
<prosody pitch="+9st">test</prosody>
</speech>
You can also combine the two tags.

Related

Extracting full article text via the newsanchor package [in R]

I am using the newsanchor package in R to try to extract entire article content via NewsAPI. For now I have done the following :
require(newsanchor)
results <- get_everything(query = "Trump +Trade", language = "en")
test <- results$results_df
This give me a dataframe full of info of (maximum) a 100 articles. These however do not containt the entire actual article text. Rather they containt something like the following:
[1] "Tensions between China and the U.S. ratcheted up several notches over the weekend as Washington sent a warship into the disputed waters of the South China Sea. Meanwhile, Google dealt Huaweis smartphone business a crippling blow and an escalating trade war co… [+5173 chars]"
Is there a way to extract the remaining 5173 chars. I have tried to read the documentation but I am not really sure.
I don't think that is possible at least with free plan. If you go through the documentation at https://newsapi.org/docs/endpoints/everything in the Response object section it says :
content - string
The unformatted content of the article, where available. This is truncated to 260 chars for Developer plan users.
So all the content is restricted to only 260 characters. However, test$url has the link of the source article which you can use to scrape the entire content but since it is being aggregated from various sources I don't think there is one automated way to do this.

How to split robot testcases using colon, so that each will be treated as separate testcase?

I have 3 test cases which will test the same functionality. It will use same keywords as shown below.
Instead of writing three different test cases "test-1151,test-2125,test-2126", I want to write one test case separated with colons as shown below. But robot should treat this as three seperate test case and it should show pass/fail test case count accordingly.
test.robot:
*** Settings ***
Library lib.test
*** Variables ***
*** Keywords ***
*** Test Cases ***
test-1151:test-2125:test-2126
[Documentation] test_sample
[Tags] sanity
Install Adobe software
Launch the app
If I run the above robot file, robot is taking "test-1151:test-2125:test-2126" as one test case. How to tell robot to treat this as three different test cases (separated with colon)?
Why don't you turn the detail of the test case into a keyword? Then write three test cases that call the keyword?
This might be an alternative option for you:
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#data-driven-style
Basically have one test template which would be the same, maybe have some arguments for parameters that will change based on test cases. You can then have many test cases doing exactly the same or slightly different things in a short and concise notation.
It's unclear what your real goals are. It seems that you want to see three items in the report, "test-1151", "test-2125", and "test-2126", but that you actually only want to run that test once.
I'm guessing that those names correspond to either a test plan or an item in a ticketing system of some sort.
My recommendation is to use tags to tag your test. You can give the test any name you want, and then give it tags for the names you want to see in the report. Once the test runs, the report can give you statistics based on tag.
For example:
test-1151:test-2125:test-2126
[Documentation] test_sample
[Tags] sanity test-1151 test-2125 test-2126
Install Adobe software
Launch the app
To answer your specific question of whether you can have this one test reported three times, the answer is "no". It will show up in the logs and report as a single test. However, the report also includes test status by tag, so you will see one item in the report for each tag.

Testing DAX calculation with NBi

I'm doing some research on automated test tool for our SSAS Tabular project. I found NBi and thought it is really cool. I attempted to set it up and successfully ran some basic tests. However, when I attempted to test dax calculation, it says "Function not found" (see screenshot). It sounds like it does not support SUM, but given that SUM is a basic function I would imagine it should work. Since I'm new to this tool, I wanted to double check if I've done something wrong or it is simply what the error is saying... (not supported function).
I went back and review NBi documentation and it mentioned to check out their NCAL.dll for all available expression. Unfortunately, I'm unable to open a readable version of that dll file. Any help is appreciated.
Here is the formula I want to test:
=SUMX(FILTER(MyTable, AND(MyTable[Date] = EARLIER(MyTable[Date]), MyTable[Account] = EARLIER(MyTable[Account]))), MyTable[Amount])
XML code (nbits) file
<test name="My second test: Calculated column compared to DAX formula">
<system-under-test>
<execution>
<query connectionString="Provider=MSOLAP.7;Data Source...">
<![CDATA[
EVALUATE
SUMMARIZE (MyTable, MyTable[Date], MyTable[Account], MyTable[Amount], MyTable[CalculatedAmount])
]]>
</query>
</execution>
</system-under-test>
<assert>
<evaluate-rows>
<variable column-index="0">Date</variable>
<variable column-index="1">Account</variable>
<variable column-index="2">Amount</variable>
<variable column-index="3">CalculatedAmount</variable>
<expression column-index="3" type="numeric" tolerance="0.01"> = SUMX(FILTER(MyTable, AND(MyTable[Date] = EARLIER(MyTable[Date]), MyTable[Account] = EARLIER(MyTable[Account]))), MyTable[Amount])</expression>
</evaluate-rows>
</assert>
</test>
NBi supports the evaluation of DAX queries in the query tag but not in an expression tag. Expression and evaluate-rows tags are not designed to compare two queries. To achieve this, change your test to use the assertion equalTo between your two queries. It will be easier and will work.
I guess a better question would be how do I test a measure and a
calculated column in term of ensuring that another developer doesn't
accidentally change the calculation/expression I entered when
designing the Tabular model?
I'll answer at three levels: conceptual, logical and technical.
At the conceptual level, your test is wrong: you should never use the same implementation in your assertion and in your system-under-test. This is not specifc to NBi or to any framework but to all automated tests. The role of a test is not ensure that someone doesn't change something but to ensure that something gives the correct result. Comparing an artifact to itself will always result in a green test even if your implementation is wrong. In this case, you must change your assertion with a concrete static result or you need to create a sql statements resulting in the same calculation of your database or find another query in MDX resulting in the same result.
At the logical level the following sentence is not correct
Here is the formula I want to test:
You've defined this formula in your assert and not in your system-under-test. It means that it's not what you're testing but it's your reference (something you're 100% sure that it's correct). What you're testing is the query EVALUATE SUMMARIZE (MyTable, MyTable[Date], MyTable[Account], MyTable[Amount], MyTable[CalculatedAmount]).
At the technical level, using an evaluate-rows is nopt the correct option. This assertion is not expecting a function or a query but an expression based on row's variable (no DAX, no SQL, ...). The usage of EARLIER is a clear sign that it won't be possible. In your case, you must compare two queries probably something as:
<assert>
<equalTo>
<column index="0" role="key" type="dateTime"/>
<column index="1" role="key" type="numeric"/>
<column index="2" role="value" type="numeric"/>
<column index="3" role="value" type="numeric" tolerance="0.01"/>
<query>
EVALUATE SUMMARIZE (MyTable, MyTable[Date], MyTable[Account], MyTable[Amount], SUMX(FILTER(MyTable, AND(MyTable[Date] = EARLIER(MyTable[Date]), MyTable[Account] = EARLIER(MyTable[Account]))), MyTable[Amount])
</query>
</equalTo>
</assert>
PS: I'm clearly not a specilist of DAX and I'm not sure the query above is valid from a syntax point of view.

Ensure List of elements ordered by field in element

Using Guava it is possible to ensure ascending ordering this way:
import com.google.common.collect.Ordering;
import io.predictor.dao.ohlcv.OhlcvHm;
import static java.util.stream.Collectors.toList;
assertThat("Ordered by age", Ordering.natural().isOrdered(
employees.stream().map(Employee::getAge).collect(toList())));
It is strange for me that Guava (for all its close relation to Java lambdas) does not provide easy solution for such cases.
Of course I can write some helping methods and wrap it but maybe someone has already done it in libraries. Is there an easiest method doing it? Something like:
XLibrary.isOrdered(employees, Employee::getAge);
assertThat("Ordered by age",
Ordering.from(Comparator.comparing(Employee::getAge)).isOrdered(list);
or
assertThat("Ordered by age",
Ordering.natural().onResultOf(Employee::getAge).isOrdered(list);

XSL, comparing dates to exclude any past events

I have an RSS of an events feed. I would like to hide previous events.
Assuming XML data subset of
<Navigation Name="ItemList" Type="Children">
<Page ID="x32444" URL="..." Title="Class..."
EventStartDate="20090831T23:00:00" EventEndDate="20090904T23:00:00"
EventStartTime="20090830T15:30:00" EventEndTime="20090830T18:30:00" Changed="20090830T20:28:31" CategoryIds="" Schema="Event"
Name="Class of 2010 BAKE SALE"/>
<Page ID="x32443" URL="x32443.xml?Preview=true&Site=&UserAgent=&IncludeAllPages=true&tfrm=4" Title="Class of 2010 BAKE SALE"
Abstract="Treat yourself with our famous 10-star FRIED ICE CREAM!" EventStartDate="20090831T23:00:00" EventEndDate="20090904T23:00:00"
EventStartTime="20090830T15:30:00" EventEndTime="20090830T18:30:00" Changed="20090830T20:25:35" CategoryIds="" Schema="Event"
Name="Class of 2010 BAKE SALE"/>
<Page ID="x32426" URL="x32426.xml?Preview=true&Site=&UserAgent=&IncludeAllPages=true&tfrm=4" Title="Tribute to ..."
Abstract="Event to recognize and celebrate the lifetime of leadership and service ..."
EventStartDate="20091206T00:00:00" EventEndDate="20091206T00:00:00" EventStartTime="20090828T23:00:00" EventEndTime="20090828T04:00:00"
Changed="20090828T22:09:54" CategoryIds="" Schema="Event" Name="Tribute to ...."/>
</Navigation>
How would I not include anything past today's date
<xsl:apply-template select="Page[#EventStartDate=notBeforeToday()]"/>
Easiest with XSL parameters that you set from outside.
<xsl:param name="today" select="'undefined'" />
<!-- time passes... -->
<xsl:apply-templates select="Page[#EventStartDate < $today]"/>
Your date format is such that you can compare it using string comparison, unless there are different timezones involved. You would simply set
20091001T00:00:00
as the param value for $today. Have a look into your XSLT processor's documentation to see how.
The alternative would be to use an extension function. Here it depends on which extension functions your XSLT processor supports, so this approach won't be portable.
For this purpose, i usually add an extra date attribute in the XML which contains the day number since year 1900.
for example #dateid='9876543' or #seconds="9876675446545"
then i can can easily compare with today or another variable in the XSL.
You can also use this technique to compare times using "Unix time" for example

Resources