Annotation Type NCIntentTerm


  • @Documented
    @Retention(RUNTIME)
    @Target(PARAMETER)
    public @interface NCIntentTerm
    Annotation to mark callback parameter to receive intent term's tokens. This is a companion annotation to NCIntent and NCIntentRef annotations and can only be used for the parameters of the methods that are annotated with NCIntent or NCIntentRef. NCIntentTerm takes a term ID as its only mandatory parameter and should be applied to callback method parameters to get the tokens associated with that term (if and when the intent was matched and that callback was invoked).

    Note that if multiple intents bound to the same callback method, all such intents should have the named terms specified by this annotation.

    Here's an example of using this annotation (from LightSwitch example):

     @NCIntent("import('intents.idl')")
     @NCIntent("intent=act term(act)={has(tok_groups(), 'act')} term(loc)={trim(tok_id()) == 'ls:loc'}*")
     @NCIntentSample(Array(
         "Turn the lights off in the entire house.",
         "Switch on the illumination in the master bedroom closet.",
         "Get the lights on.",
         "Please, put the light out in the upstairs bedroom."
     ))
     def onMatch(
         @NCIntentTerm("act") actTok: NCToken,
         @NCIntentTerm("loc") locToks: List[NCToken]
     ): NCResult = {
         ...
     }
     

    Read full documentation in Intent Matching section and review examples.

    See Also:
    NCIntent, NCIntentRef, NCIntentSample, NCIntentSampleRef, NCIntentSkip, NCIntentMatch, NCModel.onMatchedIntent(NCIntentMatch)
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String value
      ID of the intent term.
    • Element Detail

      • value

        String value
        ID of the intent term.
        Returns:
        ID of the intent term.