Parsing a simple 'set timer' command to extract its intent and entities.

ID: 1454

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
t.DefaultRuleSet.CaseSensitive = false;

// Define a rule to capture the duration and unit
t.FromTo("set timer for {@Number:duration} {unit}", "INTENT:SET_TIMER DURATION:{duration} UNIT:{unit}");

var command = "set timer for 10 seconds";
Console.WriteLine(t.Transform(command));
				
			
INTENT:SET_TIMER DURATION:10 UNIT:seconds
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.DefaultRuleSet().CaseSensitive(false);

   // Define a rule to capture the duration and unit
   t.FromTo("set timer for {@Number:duration} {unit}", "INTENT:SET_TIMER DURATION:{duration} UNIT:{unit}");

   auto command = "set timer for 10 seconds";
   cout << t.Transform(command) << endl;
}
				
			
INTENT:SET_TIMER DURATION:10 UNIT:seconds
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      t.DefaultRuleSet.CaseSensitive = false
      
      '// Define a rule to capture the duration and unit
      t.FromTo("set timer for {@Number:duration} {unit}", "INTENT:SET_TIMER DURATION:{duration} UNIT:{unit}")
      
      Dim command = "set timer for 10 seconds"
      Console.WriteLine(t.Transform(command))
   End Sub
End Module
				
			
INTENT:SET_TIMER DURATION:10 UNIT:seconds