AI Bot Editor /w query sample builder
AI Bot Editor /w query sample builder
Trying to create an AI bot build that has input as
"Search google for London Bridge"
outputs as
"Search <START:engine> google <END> for <START:query> London Bridge <END>"
issue is that these XML tags cannot overlap each other, be extended to multiple words, the example above uses single words in the engine bracket, but in the query we can have multi word brackets.
the sample code allows me to select words, but handling overlapping brackets it does not.
var getAllBetween = function (firstEl, lastEl)
var firstElement = $(firstEl); // First Element
var lastElement = $(lastEl); // Last Element
var collection = new Array(); // Collection of Elements
collection.push(firstElement.attr('id')); // Add First Element to Collection
$(firstEl).nextAll().each(function () // Traverse all siblings
var siblingID = $(this).attr('id'); // Get Sibling ID
if (siblingID !== $(lastElement).attr('id')) // If Sib is not LastElement
collection.push($(this).attr('id')); // Add Sibling to Collection
else // Else, if Sib is LastElement
collection.push(lastElement.attr('id')); // Add Last Element to Collection
return false; // Break Loop
);
return collection; // Return Collection
;
$("#editable").mouseup(function ()
if (window.getSelection)
userSelection = window.getSelection();
rangeObject = userSelection.getRangeAt(0);
if (rangeObject.startContainer === rangeObject.endContainer)
alert(rangeObject.startContainer.parentNode.id);
else
alert(getAllBetween(
rangeObject.startContainer.parentNode,
rangeObject.endContainer.parentNode));
);
using razor:
@for (int i = 0; i < sentences.Length; i++)
var phrase = sentences[i].Split(' ');
<p id="editable">
@for (int p = 0; p < phrase.Length; p++)
<span id="phrase-@i-@p">@phrase[p]</span>
</p>
Not sure if it should be rewritten in Angularjs or VueJs, to create more dynamics as Luis.ai or DialogFlow
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy