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

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)