Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

The FAQ stage does a semantic comparison of a sentence against questions and its respective answer (using TensorFlow), if the confidence value is in the threshold, it will create a tag holding the question and answer.


This recognizer uses a frozen Universal Sentence Encoder TensorFlow model to encode (using sentence embedding vectors) a list of Frequently Asked Questions. Then tags sentences that match a question/answer pair given a specified threshold of accuracy with the question/answer from the FAQ. Most recently the FAQ also can use Saga Python Bridge to encode the sentence with different algorithms.

Operates On:  Lexical Items with TOKEN and possibly other flags as specified below.

Library: saga-fag-stage

Saga_is_recognizer

Include Page
Generic Configuration Parameters
Generic Configuration Parameters

Configuration Parameters

  • Parameter
    summaryName of the resource containing the questions of the FAQ
    namequestions
    requiredtrue
  • Parameter
    summaryIndicates the tag which is going to be use for tagging
    defaultquestionTag
    nametagWith
  • Parameter
    summaryPath to the TensorFlow model in case the TensorFlow model is going to be used
    namemodelPath
    requiredtrue
  • Parameter
    summaryThreshold indicating when a predictions is acceptable
    default0.6
    namethreshold
    typedouble
  • Parameter
    summaryIndicates if the FAQ is going to use TensorFlow or Saga Bridge
    defaulttrue
    nameuseTensorFlow
    typeboolean
  • Parameter
    summaryIndicates if the sentence must be compared against the answer as well
    nameevalAnswers
    typeboolean
  • Parameter
    summaryModel name registered in the python bridge
    defaultbert-base-uncased
    namemodelName
    requiredtrue
  • Parameter
    summaryModel version registered in the python wrapper to query
    default1
    nameversion
  • Parameter
    summaryPython server communication hostname
    defaultlocalhost
    namehostname
  • Parameter
    summaryPython server communication port
    default5000
    nameport
    typeinteger


Code Block
languagejs
"questions": "saga_provider:saga_faq",
"tagWith": "question",
"modelPath": "./tf-model",
"threshold": 0.6,
"useTensorFlow": true,
"evalAnswers": true,
"modelName": "bert-base-uncased",
"version": "1",
"hostname": "localhost",
"port": 5000,


Example Output

Code Block
languagetext
themeFadeToGrey
V---------------------[Any analytics available for Internal Sites? Why are dogs always hungry?]---------------------V 
^----------[Any analytics available for Internal Sites? ]-----------V---------[Why are dogs always hungry?]---------^ 
^-[Any]-V-[analytics]-V-[available]-V-[for]-V-[Internal]-V-[Sites?]-^-[Why]-V-[are]-V-[dogs]-V-[always]-V-[hungry?]-^ 
^----------------------------[{question}]---------------------------^


Output Flags

Lex-Item Flags:

  • SEMANTIC_TAG - Identifies all lexical items which are semantic tags.
  • ANSWER- Identifies a lexical item holding an answer from the FAQ.

Vertex Flags:

Info

No vertices are created in this stage


Resource Data

Description of resource.

Resource Format

Saga_jsoncode
TitlelanguageEntity Json Formatjs
"_id" : "KGAAJGsBemSwA0nZTLXA",
"tag": "animals",
"question" : "This is a cat?",
"answer" : "That's a tiger",
"fields" : {
    "questionVector" : [ 0.058885570615530014, -0.002637901809066534, ... ],
    "answerVector" : [ 0.34535465645635530014, 0.002342342343453453, ... ],
    "url" : "https://isthisacat.com"
    . . . additional fields as needed go here . . . 
}
"confAdjust": 0.95
Note
  • Multiple entries can have the same pattern. If the pattern is matched, then it will be tagged with multiple (ambiguous) entry IDs.
  • Additional fielded data can be added to the record; as needed by downstream processes.

Fields

  • Parameter
    summaryquestion you want to compare against the sentence
    namequestion
    requiredtrue
  • Parameter
    summaryanswer of the question, that can be also be compare against the sentence
    nameanswer
    requiredtrue
  • Parameter
    summarymetadata of the FAQ entry
    namefields
    typejson
    requiredtrue

    • Parameter
      summarycontext vector of the question, size can change depending of the algorithm used to build it
      namequestionVector
      typedouble array
      requiredtrue
    • Parameter
      summarycontext vector of the answer, size can change depending of the algorithm used to build it
      nameanswerVector
      typedouble array
      requiredtrue
    • Parameter
      summaryfor use in external applications
      nameurl
  • Parameter
    summaryTag which will identify any match in the graph, as an interpretation
    nametag
    requiredtrue
    • These will all be added to the interpretation graph with the SEMANTIC_TAG flag.

      Tip

      Tags are hierarchical representations of the same intent. For example, {city} → {administrative-area} → {geographical-area}

Include Page
Generic Resource Fields
Generic Resource Fields