Retrive Wordoffsets for interim results - c#

I am using the following config to retrieve results from the speech api:
StreamingConfig = new StreamingRecognitionConfig
{
Config = new RecognitionConfig
{
Encoding = RecognitionConfig.Types.AudioEncoding.Linear16,
SampleRateHertz = 8000,
LanguageCode = languageCode,
EnableWordTimeOffsets = true
},
InterimResults = true
}
When retriving a result, the WordTimeOffsets should be included in the WordInfos of the property Alternatives.
Unfortunately, I am only getting WordInfos for results where IsFinal = true.
When retrieving interim results the array of words is empty although a transcript is there.
I have installed 1.1.0-beta02 from nuget and setup a .NET Core project.
I have read through the documentation and through some articles in the internet but found no hint that the wordinfos are only filled for final results.
Please let me know if you need some additional information.

Related

Create a site term column with graph API

I'm trying to add a new column to a site using MS Graph API. I followed the docs, which shows a Text column example, and that works. When I try to add a Term column I get an invalid request. Does anyone have any insight as to what I've done wrong?
See my code below.
var columnDef = new ColumnDefinition
{
DisplayName = "Tag",
EnforceUniqueValues = false,
Hidden = false,
Indexed = false,
Name = "Tag",
Term = new TermColumn
{
ShowFullyQualifiedName = false,
AllowMultipleValues = false
}
};
await graphAPIAuth.Sites[site.Id].Columns
.Request()
.AddAsync(columnDef);
The graph api doesn't currently support creating columns for any type fields other than plain text, I suggest you submit user voice to add support for other types of fields, I'll upvote for you.

How can we add existing links in Azure DevOps programmatically

I want to link the existing work items which are already created in a project under Azure DevOps by writing a code or program in C#, so is there any kind of API or SDK which can be used to link the work items programmatically?
The Workitems can be of any type i.e.
Bug
User Story
Issue
Task etc.
The linking between the Workitems can also be of any type i.e. Relational, Parent-Child, etc.
Recently I referred to this link for my problem.
The link contains issue very much related and similar to mine, however it is not working as expected when I tried it.
Given:
//int relatedId = ...
//int id = ...
//CancellationToken token = ...
//string organization = ...
//string projectName = ...
//WorkItemTrackingHttpClient azureClient = ...
Create a JsonPatchDocument as below:
JsonPatchDocument patchDoc = new JsonPatchDocument();
patchDoc.Add(
new JsonPatchOperation
{
From = null,
Operation = Operation.Add,
Path = "/relations/-",
Value = new {
rel = "System.LinkTypes.Related",
url = $"https://dev.azure.com/{organization}/{projectName}/_workitems/edit/{relatedId}",
attributes = new
{
comment = $"Created programmatically on {DateTime.Now}."
}
}
}
);
and call this async method of Azure DevOps SDK:
await azureClient.UpdateWorkItemAsync(patchDoc, id, false, true, true, WorkItemExpand.All, cancellationToken: token);
In the case above we created a related link using System.LinkTypes.Related referenceName.
For a full link types reference guide in Azure DevOps refer to this so's question or this microsoft's doc.

How do I add a structured ODBC data source to a tabular model using the AMO tabular library

Adding a structured ODBC data source to my model results in an error.
I want to generate a tabular model on a SQL Analysis Services server with compatibility level 1400 using the Microsoft.AnalysisServices.Tabular library using structured (ie. M / Power Query), non-legacy (ie. ProviderDataSource) data sources.
I installed the library using NuGet package Microsoft.AnalysisServices.retail.amd64 (16.3.0).
Here's my data source definition.
myDatabase.Model.DataSources.Add(new StructuredDataSource()
{
Name = "ODBC",
Description = "An structured ODBC data source definition",
ConnectionDetails = new ConnectionDetails()
{
Protocol = DataSourceProtocol.Odbc
},
Credential = new Credential()
{
AuthenticationKind = AuthenticationKind.UsernamePassword,
EncryptConnection = false,
Username = "MYUSERNAME",
Password = "MYPASSWORD"
}
}
When I run this code, I get:
COM error: Microsoft.Data.Mashup; The given data source reference is not a valid data source.
It doesn't give me any pointers where to look or what is wrong specifically. I suspected the definition needed a server address, but the address property of the ConnectionDetails object cannot be set according to the documentation.
ConnectionDetails.Address Property
Address of this connection. It can't be set, instead it should be modified directly.
When reviewing my question and off course further investigating the documentation, I constructed this solution. For those who struggle with the same problem, I figured it'd be nice to post it here.
Credential credential = new Credential()
{
AuthenticationKind = AuthenticationKind.UsernamePassword,
EncryptConnection = false,
Username = "MYUSERNAME",
Password = "MYPASSWORD" // Please note that this won't persist.
};
ConnectionDetails connectionDetails = new ConnectionDetails("{ 'protocol': 'odbc', 'address': { 'options': { 'dsn': 'MYODBCDSN' } }, 'authentication': null, 'query': null }");
dbWithDataSource.Model.DataSources.Add(new StructuredDataSource()
{
Name = "ODBC",
Description = "An ODBC structured (ie. non-legacy) data source definition",
ConnectionDetails = connectionDetails,
Credential = credential,
Options = new DataSourceOptions( "{ 'hierarchicalNavigation': true }" )
}
What I basically did, was pass in a JSON string in the ConnectionDetails constructor, setting the 'read-only' address property as well.

Elasticsearch & NEST with .NET - No Data Returned

Is there any debugging in NEST? I am wasting a lot of time without any error codes. I get no data returned but the data exists. The code is below -
Uri node;
ConnectionSettings settings;
//ElasticClient client;
node = new Uri("https://.......qb0x.com:30950");
settings = new ConnectionSettings(node, defaultIndex: "soogrindex");
var client = new ElasticClient(settings);
SearchResults sr = new SearchResults();
var searchDataResults = client.Search<SearchRow>(s=>s.AllIndices().AllTypes().Query(q=>q.Term(p=>p.partnumber, "*")));
Any ideas how to debug? It just returns nothing. A curl in ubuntu shows the data there. The .net is under windows.
The solution is about case, the data has "Test2" but the search fails to match on "Test2" but "test2" works. I have no idea why but there must be defaults set in ES.
Here is the corrected form -
var searchDataResults = client.Search<SearchRow>(s=>s.AllIndices().AllTypes().Query(q=>q.Term(p=>p.partnumber, "test2")));

Google Custom Site Search Api C# Paging

I am using the Google C# API for the Custom Search and have it working and returning results, however I cannot see a way to make the paging work correctly.
Looking at what I get returned, no where does it tell me how many pages there are in the result? It just has a .Start property? Which is not much good unless I know how many 'pages' of results I have?
Am I missing something stupid here? Here is an example of the code I have so far
var svc = new CustomsearchService(new BaseClientService.Initializer { ApiKey = settings.GoogleCustomSearchApi });
var listRequest = svc.Cse.List(searchTerm);
listRequest.Cx = settings.GoogleCustomSearchEngineId;
listRequest.ImgSize = CseResource.ListRequest.ImgSizeEnum.Medium;
listRequest.Num = 10;
// List to hold everything in
var resultItems = new List<Google.Apis.Customsearch.v1.Data.Result>();
// Result set 1
listRequest.Start = 1;
var search = listRequest.Execute();
resultItems.AddRange(search.Items);
I have resulted at the moment to doing two or three calls one after the other and getting a load of results back. But I would prefer to have this properly paged.
The JSON API response has totlResults field:
https://developers.google.com/custom-search/json-api/v1/reference/cse/list#response.
It should be exposed under search.Queries
Found it, its in
search.SearchInformation.TotalResults

Categories

Resources