NLPCraft

     _   ____      ______           ______
    / | / / /___  / ____/________ _/ __/ /_
   /  |/ / / __ \/ /   / ___/ __ `/ /_/ __/
  / /|  / / /_/ / /___/ /  / /_/ / __/ /_
 /_/ |_/_/ .___/\____/_/   \__,_/_/  \__/
        /_/

SCALA3 API TO CONVERT NATURAL LANGUAGE INTO ACTION

License Maven Central

Maven dependency:

<dependency>
  <groupId>org.apache.nlpcraft</groupId>
  <artifactId>nlpcraft</artifactId>
  <version>1.0.0</version>
</dependency>

SBT dependency:

libraryDependencies += "org.apache.nlpcraft" % "nlpcraft" % "1.0.0"

Annotations:

Due to Scala 3 limitation on runtime retained annotations NLPCraft annotations are written in Java. Javadoc documentation cannot be readily integrated into standard Scaladoc toolchain and thus NLPCraft annotations are listed here along with their source code for the purpose of documentation:

org.apache.nlpcraft.annotations.NCIntent

// Annotation to bind an intent with the method serving as its callback.
@Documented
@Retention(value=RUNTIME)
@Target(value={METHOD, TYPE})
@Repeatable(NCIntent.NCIntentList.class)
public @interface NCIntent {
    // Intent specification using IDL.
    String value() default "";

    // Grouping annotation required for when more than one 'NCIntent' annotation is used.
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @Target(value={METHOD, TYPE})
    @interface NCIntentList {
        // Gets the list of all 'NCIntent' annotations attached to the callback or class.
        NCIntent[] value();
    }
}

org.apache.nlpcraft.annotations.NCIntentRef

// Annotation referencing an intent defined outside of callback method declaration.
@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
@Repeatable(NCIntentRef.NCIntentRefList.class)
public @interface NCIntentRef {
    // ID of the intent defined externally.
    String value() default "";

    // Grouping annotation required for when more than one 'NCIntentRef' annotation is used.
    @Retention(RetentionPolicy.RUNTIME)
    @Target(value=METHOD)
    @Documented
    @interface NCIntentRefList {
        // Gets the list of all 'NCIntentRef' annotations attached to the callback.
        NCIntentRef[] value();
    }
}

org.apache.nlpcraft.annotations.NCIntentTerm

// Annotation to mark callback parameter to receive intent term's tokens.
@Documented
@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface NCIntentTerm {
    // ID of the intent term.
    String value();
}

org.apache.nlpcraft.annotations.NCIntentObject

// Marker annotation that can be applied to class member of main model.
// The fields objects annotated with this annotation are scanned the same way as main model.
@Documented
@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface NCIntentObject {
    // No-op.
}