I'm using Microsoft.Skills.Text.EntityRecognitionSkill in my skillset which output "Person", "Location", "Organization".
however I want to only output Location that have a confident level > .5
is there a way to do that?
here is a snap of my code
{
"#odata.type": "#Microsoft.Skills.Text.EntityRecognitionSkill",
"categories": [
"Person",
"Location",
"Organization"
],
"context": "/document/finalText/pages/*",
"inputs": [
{
"name": "text",
"source": "/document/finalText/pages/*"
},
{
"name": "languageCode",
"source": "/document/languageCode"
}
],
"outputs": [
{
"name": "persons",
"targetName": "people"
},
{
"name": "locations"
},
{
"name": "namedEntities",
"targetName": "entities"
}
]
},
[Edited based on Mick's comment]
Yes, this should be possible by setting the minimumPrecision parameter of the entity recognition skill to 0.5, which will result in entities whose confidence is >= 0.5 to be returned.
The documentation for entity recognition skill is here: https://learn.microsoft.com/en-us/azure/search/cognitive-search-skill-entity-recognition
As Mick points out, the documentation says minimumPrecision is unused, however that documentation is out of date and I will fix it soon.
Related
I am currently using micro soft's speech studio to create a simple chat bot. For all my questions, I need to add a confirmation rule to ask if they need further assistance getting to the location they are looking for. However after it gets to the last part of the speech command it keeps saying the speech 2 times instead of just that once. For example, for this question on where chambers b is for example, it will say the speech response twice instead of just that once that it used to output just 2 days back.
the example sentences page
this is my confirmation command in the speech studio to ask whether they need assistance getting to the location
this is my successful command assuming the user says yes during the confirmation stage
However the issue came about just yesterday when I was testing the chatbot. I got this output during testing: "Sure, please follow me now" twice instead of just once that I needed.
this is what came up during the testing phase. As you can see it said sure please follow me now 2 times instead of just that 1 time that I needed
Thanks for reaching out.
The configuration in the screenshots look OK.
I created a confirmation example to verify the behavior and I was not able to reproduce this with the windows client (same you used in your screenshots).
Here is the sample app you can import to try it out.
{
"entityResolver": {
"searchConfiguration": {
"maxEdits": 0
},
"type": "internal",
"isGenerated": true
},
"minIntentConfidence": 0.4,
"highIntentConfidence": 0.8,
"lgTemplates": [
"# FallbackResponse",
"- Add your fallback message here",
"# TestCommand-MyNumber",
"- what number?",
"# TestCommand-27dfe650040311ebb2dccf4459b3ff8b",
"- confirmed.",
"# TestCommand-3228f4d0040311ebb2dccf4459b3ff8b",
"- denied.",
"# TestCommand-4ea19f40040311ebb2dccf4459b3ff8b",
"- sure?"
],
"type": "BaseLanguage",
"recognizer": {
"application": "",
"isStaging": false,
"versionId": "0.1",
"type": "luis"
},
"speechOutput": {
"font": "Microsoft Server Speech Text to Speech Voice (en-US, Aria24kRUS)",
"locale": "en-US"
},
"webEndpoints": [],
"globalParameters": [],
"commands": [
{
"name": "FallbackCommand",
"completionStrategy": "OnRequiredParameters",
"parameters": [],
"rules": [],
"completionRules": [
{
"name": "DefaultResponse",
"conditions": [
{
"type": "True"
}
],
"actions": [
{
"type": "SpeechResponse",
"response": {
"type": "Template",
"templateName": "# FallbackResponse"
}
}
],
"postExecutionState": "None"
}
],
"triggeringExamples": [
"> - You can start sentences with '>' to add comments.",
"> - You can also use parameters by adding the name of the parameter within curly braces, i.e.",
"> Set an alarm to {YourDateParameterName}",
"> Where YourDateParameterName is the name of a parameter defined in the 'Parameters' section.",
"Help",
"Help me",
"What can you do?",
"How can I start?",
"Hello",
"Hi"
],
"multiTurnExamples": []
},
{
"name": "TestCommand",
"completionStrategy": "OnRequiredParameters",
"parameters": [
{
"name": "MyNumber",
"type": {
"name": "Number"
},
"elicitResponse": {
"type": "Template",
"templateName": "# TestCommand-MyNumber"
}
}
],
"rules": [
{
"name": "Confirm command",
"conditions": [
{
"type": "AllRequiredParameters"
}
],
"actions": [
{
"type": "SpeechResponse",
"response": {
"type": "Template",
"templateName": "# TestCommand-4ea19f40040311ebb2dccf4459b3ff8b"
}
}
],
"nextTurnExpectations": [
{
"type": "Confirmation"
}
],
"postExecutionState": "WaitForInput"
},
{
"name": "Confirmation succeeded",
"conditions": [
{
"type": "SuccessfulConfirmation"
}
],
"actions": [
{
"type": "SpeechResponse",
"response": {
"type": "Template",
"templateName": "# TestCommand-27dfe650040311ebb2dccf4459b3ff8b"
}
}
],
"nextTurnExpectations": [],
"postExecutionState": "ReadyForCompletion"
},
{
"name": "Confirmation denied",
"conditions": [
{
"type": "DeniedConfirmation"
}
],
"actions": [
{
"type": "SpeechResponse",
"response": {
"type": "Template",
"templateName": "# TestCommand-3228f4d0040311ebb2dccf4459b3ff8b"
}
}
],
"nextTurnExpectations": [],
"postExecutionState": "CompleteCommand"
}
],
"completionRules": [
{
"name": "Done",
"conditions": [
{
"type": "True"
}
],
"actions": [],
"nextTurnExpectations": [],
"postExecutionState": "CompleteCommand"
}
],
"triggeringExamples": [
"number {MyNumber}",
"my number is {MyNumber}"
]
}
]
}
And here is a sample output with the windows client.
Sample output
Hope this help! o.w. If you could clone your application and provide a stripped-down version with the failure and we'll be happy to help you troubleshoot further.
From my understanding of the JSON:API spec (specifically https://jsonapi.org/format/#document-resource-object-linkage) I should be able to include meta members for each member of a relationship.
I have been able to add a hash of meta data to the relationships object itself, but not one to each of the individual relationships within.
class PlanSerializer < ApplicationSerializer
attributes :id, :name
has_many :features do
meta value: "x"
end
end
I know I can use a block syntax for has_many, and think that's the way to achieve this. But I haven't got it working. Calling the meta method within the block adds the meta block to the features relationship object, and I need to add one to each entry in that array.
My questions:
Have I understood the spec correctly? Should I be able to add a meta object to each relationship?
How would I go about doing this with the active model serializers?
Background:
My goal is to represent a many-many from Plans to Features where each plan might have some extra information for it's own relationship to a given Feature (and that information is different for every Plan, so it doesn't belong on the Feature object)
If your answer is that I shouldn't be doing this, that's fine, but please present an alternative which you think is preferred.
// My desired output
{
"data": [
{
"id": "small",
"type": "plans",
"attributes": {
/* Some attributes */
},
"relationships": {
"features": {
"data": [
{
"id": "num-users",
"type": "features",
"meta": {
"value": 1
}
},
{
"id": "num-projects",
"type": "features",
"meta": {
"value": 5
}
}
]
}
}
},
{
"id": "large",
"type": "plans",
"attributes": {
/* Some attributes */
},
"relationships": {
"features": {
"data": [
{
"id": "num-users",
"type": "features",
"meta": {
"value": 5
}
},
{
"id": "num-projects",
"type": "features",
"meta": {
"value": 50
}
},
{
"id": "unlimited-downloads",
"type": "features"
}
]
}
}
}
],
"included": [
{
"id": "num-users",
"type": "features",
"attributes": {
"description": "Number of users"
}
},
{
"id": "num-projects",
"type": "features",
"attributes": {
"description": "Number of projects"
}
},
{
"id": "unlimited-downloads",
"type": "features",
"attributes": {
"description": "Unlimited downloads"
}
}
]
}
I am trying to get data using elastic search in a python program. Currently I am getting the following data from an elastic search request. I wish to sort the data on rank:type. For example i want to sort data by raw_freq or maybe by score.
What should the query look like?
I believe it will be something using nested query. Help would be very much appreciated.
{
"data": [
{
"customer_id": 108,
"id": "Qrkz-2QBigkG_fmtME8z",
"rank": [
{
"type": "raw_freq",
"value": 2
},
{
"type": "score",
"value": 3
},
{
"type": "pmiii",
"value": 1.584962
}
],
"status": "pending",
"value": "testingFreq2"
},
],
}
Here is a simple example of how you can sort your data:
"query": {
"term": {"status": "pending"}
},
"sort": [
{"rank.type.keyword": {"order" : "desc"}}
]
I'm looking at the documentation of the rest API and I'm looking to get the costs of my resources.
Looking at both the REST API and SDK for .NET, there's a Consumption endpoint that does this, but on further testing, this only seems to provide the latest available billing cycle (24 hour window).
Example Code:
var filterString = $"properties/instanceName eq \'{vm.VirtualMachineName}\'";
var vmConsumptionData = await consumptionClient.Item1.UsageDetails.ListAsync(
scope: $"/subscriptions/{consumptionClient.subscriptionGuid}",
filter: filterString
);
consumptionClient is an instance of a consumptionClient returned as part of a Tuple elsewhere.
Result is yesterdays last billed amount.
Are there any other endpoints that would provide a more up to date cost overview of my resources in Azure? I.E. Per minute or hour
The only other way I believe this can be done is to retrieve the 'Usage quantity' of a resource and work this out based on the resources cost per hour.
As of Mar-06-2020 documentation on Microsoft.CostManagement/Query worked:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.CostManagement/query?api-version=2019-11-01&$top=10000
Content-Type: application/json
{
"type": "ActualCost",
"dataSet": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
},
"totalCostUSD": {
"name": "PreTaxCostUSD",
"function": "Sum"
}
},
"filter": {
"Dimensions": {
"Name": "ResourceId",
"Operator": "In",
"Values": [
"{resourceId}"
]
}
}
},
"timeframe": "Custom",
"timePeriod": {
"from": "2020-02-29T00:00:00+00:00",
"to": "2020-03-06T23:59:59+00:00"
}
}
with response:
{
"id": "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.CostManagement/query/XXXXXXXX-9ab4-XXXX-83fe-XXXXXXXXXXXX",
"name": "XXXXXXXX-9ab4-XXXX-83fe-XXXXXXXXXXXX",
"type": "Microsoft.CostManagement/query",
"location": null,
"sku": null,
"eTag": null,
"properties": {
"nextLink": null,
"columns": [
{
"name": "PreTaxCost",
"type": "Number"
},
{
"name": "Currency",
"type": "String"
}
],
"rows": [
[
1234.5678910,
"CAD"
]
]
}
}
I found this returns accurate value for my specific resource.
NOTE: Only concern is that this API endpoint is flagged as -legacy in the documentation. Not sure if it will be supported long term but works for now.
Say I have a product collection like this:
{
"_id": "5a74784a8145fa1368905373",
"name": "This is my first product",
"description": "This is the description of my first product",
"category": "34/73/80",
"condition": "New",
"images": [
{
"length": 1000,
"width": 1000,
"src": "products/images/firstproduct_image1.jpg"
},
...
],
"attributes": [
{
"name": "Material",
"value": "Synthetic"
},
...
],
"variation": {
"attributes": [
{
"name": "Color",
"values": ["Black", "White"]
},
{
"name": "Size",
"values": ["S", "M", "L"]
}
]
}
}
and a variation collection like this:
{
"_id": "5a748766f5eef50e10bc98a8",
"name": "color:black,size:s",
"productID": "5a74784a8145fa1368905373",
"condition": "New",
"price": 1000,
"sale": null,
"image": [
{
"length": 1000,
"width": 1000,
"src": "products/images/firstvariation_image1.jpg"
}
],
"attributes": [
{
"name": "Color",
"value": "Black"
},
{
"name": "Size",
"value": "S"
}
]
}
I want to keep the documents separate and for the purpose of easy browsing, searching and faceted search implementation, I want to fetch all the data in a single query but I don't want to do join in my application code.
I know it's achievable using a third collection called summary that might look like this:
{
"_id": "5a74875fa1368905373",
"name": "This is my first product",
"category": "34/73/80",
"condition": "New",
"price": 1000,
"sale": null,
"description": "This is the description of my first product",
"images": [
{
"length": 1000,
"width": 1000,
"src": "products/images/firstproduct_image1.jpg"
},
...
],
"attributes": [
{
"name": "Material",
"value": "Synthetic"
},
...
],
"variations": [
{
"condition": "New",
"price": 1000,
"sale": null,
"image": [
{
"length": 1000,
"width": 1000,
"src": "products/images/firstvariation_image.jpg"
}
],
"attributes": [
"color=black",
"size=s"
]
},
...
]
}
problem is, I don't know how to keep the summary collection in sync with the product and variation collection. I know it can be done using mongo-connector but i'm not sure how to implement it.
please help me, I'm still a beginner programmer.
you don't actually need to maintain a summary collection, its redundant to store product and variation summary in another collection
instead of you can use an aggregate pipeline $lookup to outer join product and variation using productID
aggregate pipeline
db.products.aggregate(
[
{
$lookup : {
from : "variation",
localField : "_id",
foreignField : "productID",
as : "variations"
}
}
]
).pretty()