Special characters in Smartsheet API (2.0) - search - smartsheet-api

Within the API for smartsheet I use the search everything method.
However, when trying to search for 'A01 PXXX' it returns me also rows (and cells) which contain only 'A01' and 'PXXX'. Is there a way to search for the whole searchstring (so including the space character)

If you URL-encode the space character in the query querystring parameter value, it the Search Everything operation should return only results that contain the full string.
For example, I have a sheet that contains these values:
I execute the following request: GET https://api.smartsheet.com/2.0/search?query=A01%20PXXX
And the response contains search results for only the two rows that contain the string "A01 PXXX":
{
"results": [
{
"text": "A01 PXXX",
"objectType": "row",
"objectId": 8740290866505604,
"parentObjectType": "sheet",
"parentObjectId": 505434269345668,
"parentObjectName": "Project Plan (Office Timeline Test)",
"contextData": [
"Row 20"
]
},
{
"text": "A01 PXXX",
"objectType": "row",
"objectId": 1732072470538116,
"parentObjectType": "sheet",
"parentObjectId": 505434269345668,
"parentObjectName": "Project Plan (Office Timeline Test)",
"contextData": [
"Row 17"
]
}
],
"totalCount": 2
}

Related

How do I add a code snippet with a number as a tabstop

Consider the following JSON schema snippet:
{
"label": "New spell",
"description": "Creates a new spell",
"body": {
"name": "$1",
"source": "$2",
"page": "${3}",
"tradition": "$4",
"type": "${5|U,A|}",
"level": "${6}",
"description": ["$7"]
}
}
Both page and level need to be an integer (can default to 0), but also be a tabstop. I have tried a few things, but the only value that acts as a tabstop is enclosed in quotes, so it ends up being a string.
Is there a way to add a tabstop where the default value is a number?
This would work to set a tabstop 3 and 6 with defaults of 0. Note that the quotes must be escaped.
"\"page\": \"${3:0}\""
Also the general form of a snippet is as follows:
"new spell": {
"description": "Creates a new spell",
// "scope": "javascript,typescript",
"prefix": "new spell", // whatever prefix you want
"body": [ // array
"\"page\": \"${3:0}\"",
"\"level\": \"${6:0}\"",
]
}
There is no label property and there should be a prefix property. And body, if multiple statements is an array.
As it says in the documentation:
If a string starts with ^, the string content will be inserted as-is, not stringified. You can use this to specify snippets for numbers and booleans.
The value string needs to be specified as "^${3:0}".
So, the snippet fixed:
{
"label": "New spell",
"description": "Creates a new spell",
"body": {
"name": "$1",
"source": "$2",
"page": "^${3:0}",
"tradition": "$4",
"type": "${5|U,A|}",
"level": "^${6:0}",
"description": ["$7"]
}
}

What are special characters supported on the smartsheet api search

Right now form my understanding the smartsheet search is looking for anything alike the term searched.
Let's say i am looking for 'test' :
https://api.smartsheet.com/2.0/search?query=test
It can return :
my testimonial
test
i detest potatoes
yet a regular test
If there any special characters to perform a more advanced search (like a SQL like query) ?
exact match ?
begins with ?
ends with ?
I'm not sure that the /search endpoint supports special characters in the same way that SQL query would. However, both of the following scenarios are supported:
Scenario #1: find places where the specified string exists as a separate word (case-insensitive)
Scenario #2: find places where the specified string exists either as a separate word OR as a part of another word (case-insensitive)
The two examples below demonstrate each of these scenarios, by searching a sheet that looks like this:
Scenario #1: find places where the specified string exists as a separate word (case-insensitive)
To find places where the specified string exists as a separate word, enclose that string (i.e., the value of the query parameter) in double quotes.
API request: GET https://api.smartsheet.com/2.0/search/sheets/5831916227192708?query="new"
API response: the response contains entries for only row #2 and row #3 -- because the word "new" (as a separate word) exists only in those two rows.
{
"results": [
{
"text": "New York, NY",
"objectType": "row",
"objectId": 5895212085602180,
"parentObjectType": "sheet",
"parentObjectId": 5831916227192708,
"parentObjectName": "SOTest",
"contextData": [
"Row 2: Meeting #2"
]
},
{
"text": "Scranton, new jersey",
"objectType": "row",
"objectId": 3643412271916932,
"parentObjectType": "sheet",
"parentObjectId": 5831916227192708,
"parentObjectName": "SOTest",
"contextData": [
"Row 3: Meeting #3"
]
}
],
"totalCount": 2
}
Scenario #2: find places where the specified string exists either as a separate word OR as a part of another word (case-insensitive)
To find places where the specified string exists either as a separate word OR as a part of another word DO NOT enclose that string (i.e., the value of the query parameter) in quotes.
API request: https://api.smartsheet.com/2.0/search/sheets/5831916227192708?query=new
API response: the response contains entries for all 5 rows -- because the string "new" exists in all of those rows.
{
"results": [
{
"text": "New York, NY",
"objectType": "row",
"objectId": 5895212085602180,
"parentObjectType": "sheet",
"parentObjectId": 5831916227192708,
"parentObjectName": "SOTest",
"contextData": [
"Row 2: Meeting #2"
]
},
{
"text": "Avonew, MS",
"objectType": "row",
"objectId": 6198495731836804,
"parentObjectType": "sheet",
"parentObjectId": 5831916227192708,
"parentObjectName": "SOTest",
"contextData": [
"Row 4: Meeting #4"
]
},
{
"text": "Newtown, PA",
"objectType": "row",
"objectId": 1391612458231684,
"parentObjectType": "sheet",
"parentObjectId": 5831916227192708,
"parentObjectName": "SOTest",
"contextData": [
"Row 1: Meeting #1"
]
},
{
"text": "Anewston, MI",
"objectType": "row",
"objectId": 3946695918151556,
"parentObjectType": "sheet",
"parentObjectId": 5831916227192708,
"parentObjectName": "SOTest",
"contextData": [
"Row 5: Meeting #5"
]
},
{
"text": "Scranton, new jersey",
"objectType": "row",
"objectId": 3643412271916932,
"parentObjectType": "sheet",
"parentObjectId": 5831916227192708,
"parentObjectName": "SOTest",
"contextData": [
"Row 3: Meeting #3"
]
}
],
"totalCount": 5
}
Unfortunately, there is not. You will need to filter the results locally after you get the search results back. If there are too many results, try limiting the scope of your search, such as one workspace at a time, or only searching for reports.

identify new words as intents in rasa nlu

Have been using rasa nlu to classify intents and entities for my chatbot. Everything works as expected (with extensive training) but with entities, it seems to predict the value based on the exact position and length of the word. This is fine for a scenario where the entities are limited. But when the bot needs to identify a word (which has a different length and not trained yet, for example a new name), it's failing to detect. Is there a way wherein I can make rasa identify the entities based on the relative position of the word or better yet, insert a list of words that becomes the domain specific for the entity to find a match with (like phrase list in LUIS)?
{"q":"i want to buy a Casio SX56"}
{
"project": "default",
"entities": [
{
"extractor": "ner_crf",
"confidence": 0.7043648832678735,
"end": 26,
"value": "Casio SX56",
"entity": "watch",
"start": 16
}
],
"intent": {
"confidence": 0.8835646513829762,
"name": "buy_watch"
},
"text": "i want to buy a Casio SX56",
"model": "model_20180522-165141",
"intent_ranking": [
{
"confidence": 0.8835646513829762,
"name": "buy_watch"
},
{
"confidence": 0.07072182459497935,
"name": "greet"
}
]
}
But if Casio SX56 gets replaced with Citizen M1:
{"q":"i want to buy a Citizen M1"}
{
"project": "default",
"intent": {
"confidence": 0.8710909096729019,
"name": "buy_watch"
},
"text": "i want to buy a Citizen M1",
"model": "model_20180522-165141",
"intent_ranking": [
{
"confidence": 0.8710909096729019,
"name": "buy_watch"
},
{
"confidence": 0.07355588750895545,
"name": "greet"
}
]
}
Thank you!
Make sure you actually added each entity value training examples before training it with rasa_nlu.
--- For successful entity extraction we need to create at least 2 or more contextual training data ---
add this eg. in rasa_nlu training data if it's not extracting properly
"text": "i want to buy a Citizen M1",
"model": "model_20180522-165141",
"intent_ranking": [
{
"confidence": 0.8710909096729019,
"name": "buy_watch"
},
{
"confidence": 0.07355588750895545,
"name": "greet"
}
]
entity extraction with phrase matching does work in rasa_nlu try it with spacy_sklearn backend pipeline
The feature I was looking for is phrase matcher which would allow me to add a list of possible entities to the training model. This way, if any new name pops up, we can simply add the name to the phrase list and the model would be able to identify it with all possible utterances. Though this is still in development and should be added to the master soon: https://github.com/RasaHQ/rasa_nlu/pull/822

Is there any ways in mongodb acts like SQL "drop column"?

I have some mongodb documents which structure like:
{
"_id": ObjectId("58c212b06ca3472b902f9fdb"),
"Auction name": "Building",
"Estimated price": "23,660,000",
"Auction result": "success",
"Url": "https://someurl.htm",
"match_id": "someid",
"Final price": "17,750,000",
"Area": [
{
"Area": "696.77"
}
]
}
The "match_id" is used for update query and after that I don't need this entry anymore.
Is there any idea to drop this entry and keep the rest of the document?
Have you tried simpily using an update query to unset the field like the following
db.products.update(
{},
{ $unset: { match_id: "" } }
)
Keep in mind that the first set of curly braces has been intentionally left blank so that your update query matches every entry in your collection

How do you get arguments of correct type in Google Actions SDK?

Google's action api seems to find the right pattern in my intent and bind to the right type, but does not return the parsed type data. For example, if I have the intent defined below in my actions.json file:
{
"description": "",
"initialTrigger": {
"intent": "RepeatIntent",
"queryPatterns": [
{
"queryPattern": "say $SchemaOrg_Number:mynumber"
},
{
"queryPattern": "say $SchemaOrg_Date:mydate"
},
{
"queryPattern": "say $SchemaOrg_Time:mytime"
}
]
},
"httpExecution": {
"url": "https://myurl/repeat"
}
}
and I enter, "at my action say tomorrow" into the simulator, I receive the following arguments:
"arguments": [
{
"name": "mydate",
"raw_text": "tomorrow",
"text_value": "tomorrow"
},
{
"name": "trigger_query",
"raw_text": "say tomorrow",
"text_value": "say tomorrow"
}
]
Note that the action SDK correctly identified "tomorrow" as type "$SchemaOrg_Date" and bound it to the mydate variable, however, it did not return the "date_value" element in the return json as specified in the documentation. I would have expected that "date_value" element to contain a parsed date structure (per the document).
The same is true of numbers although they behave slightly differently. For example, if I use the phrase "at my action say fifty", I'll receive these arguments:
"arguments": [
{
"name": "mynumber",
"raw_text": "50",
"text_value": "50"
},
{
"name": "trigger_query",
"raw_text": "say fifty",
"text_value": "say fifty"
}
]
Note that the $SchemaOrg_Number was recognized and "fifty" was correctly parsed to "50", but the int_value wasn't populated in the argument json per the documentation.
Google is actively parsing these complex types and has documented that they should be returned so I don't want to go to the trouble of parsing them myself. Any thoughts as to if this will be fixed any time soon?
The Actions SDK does not support NLU for actions. You have to use your own NLU. If you don't have your own NLU, we recommend using API.AI.