Class IntentModel

  • All Implemented Interfaces:
    java.lang.Comparable<Node>

    public class IntentModel
    extends ParentNode<InterpretationNode>
    This is the root node of an intent model. The intent model represents the intent analysis of a query. This is a probabilistic model - the query may have multiple interpretations with different probability. Each interpretation may have multiple possible intents, making this a tree.
    Author:
    bratseth
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static com.yahoo.processing.request.CompoundName intentModelObjectName
      The name of the property carrying the intent model object: IntentModel
      static com.yahoo.processing.request.CompoundName intentModelStringName
      The name of the property carrying the intent model string: intentModel
    • Constructor Summary

      Constructors 
      Constructor Description
      IntentModel()
      Creates an empty intent model
      IntentModel​(Interpretation... interpretations)
      Creates an intent model from some interpretations
      IntentModel​(java.util.List<Interpretation> interpretations)
      Creates an intent model from some interpretations
    • Field Detail

      • intentModelStringName

        public static final com.yahoo.processing.request.CompoundName intentModelStringName
        The name of the property carrying the intent model string: intentModel
      • intentModelObjectName

        public static final com.yahoo.processing.request.CompoundName intentModelObjectName
        The name of the property carrying the intent model object: IntentModel
    • Constructor Detail

      • IntentModel

        public IntentModel()
        Creates an empty intent model
      • IntentModel

        public IntentModel​(java.util.List<Interpretation> interpretations)
        Creates an intent model from some interpretations
      • IntentModel

        public IntentModel​(Interpretation... interpretations)
        Creates an intent model from some interpretations
    • Method Detail

      • sortChildren

        public void sortChildren()
        Sort interpretations by descending score order
      • getSources

        public java.util.List<SourceNode> getSources()
        Returns a flattened list of sources with a normalized appropriateness of each, sorted by decreasing appropriateness. This is obtained by summing the source appropriateness vectors of each intent node weighted by the owning intent and interpretation probabilities. Sources with a resulting probability of 0 is omitted in the returned list.
      • getSourceNames

        public java.util.List<java.lang.String> getSourceNames()
        Returns the names of the sources returned from getSources() for convenience
      • getFrom

        public static IntentModel getFrom​(Query query)
        Returns the intent model stored at property key "intentModel" in this query, or null if none
      • setTo

        public void setTo​(Query query)
        Stores this intent model at property key "intentModel" in this query