Translation feature

In the process of building the chatbot, I encountered some technical problems that need to be consulted. First, how can I use existing tools to allow users to add questions during the chat and then appear later? Second, how to achieve translation function in chat, such as English to Chinese translation function; In addition, can you define some shortcut keys under the robot?

Hi @yongming_li,

Thank you for your questions.

how can I use existing tools to allow users to add questions during the chat and then appear later?

I assume that “users” meaning people who come to chat with your chatbot. If that’s the case, you can use the IDE to write function, topic and rule for that. For more information regarding how to use the IDE you can check this page: Introduction - Juji Documentation. Also I am very curious what’s the use case for this functionality, if you don’t mind share a bit more on this, we might be able to help you better.

how to achieve translation function in chat, such as English to Chinese translation function

Currently, we support automatic Chinese to English translation such that all Chinese input will be translated into English for matching. To activate this feature, you will need to add :lang "zh-s" key-value pair in the :settings map in your config-doc (See this documentation regard details on config-doc Config-doc Guide - Juji Documentation). We do not have automatic translation from English to Chinese. However, since everything is translated to English for matching, you can just customize your response message to be Chinese. These customization can happen in the IDE rule level and in the custom actions (refer to Chatbot Design - Juji Documentation for more details on custom actions)

can you define some shortcut keys under the robot?

I assume you mean some trigger to affect the chatflow (e.g., do something like “done” to start the next question). This can be done using the custom actions

Hope this helps, please feel free to let us know if you have more questions

Thank you very much for your answer. For one thing, as for the first function, could you give me an example with specific operation steps? For example, when I build an interviewer through a conversational system, I ask the user do you have any questions you want to add? The user provides a question, and the interviewer then wants to try and get Juji to ask that question ten minutes later in the interview quiz. For another, How to increase custom actions?

In addition, is it possible for me to invite you to be my coauthor to help me revise and discuss the details of the paper? Look forward your reply

Base on your scenario, you might use different ways to add questions from user. Below is one example:

  1. Create an web engagement using a blank template
  2. Create an topic for asking the question, another topic for hosting the question.
  3. Choose the built-in dialogue of both topic to be “Ask a general question”
  4. Add topics in between if needed
  5. Go to your IDE to update your preview/web/facebook chat script and change the two topics’ script topics to the following:
(deftopic
 ask-general-question_2
 [?q]
 []
 [(ask-question ?q)]
 (handle-ask-general-question_2 ?q))

(deftopic
 handle-ask-general-question_2
 [?q]
 {:default-rules
  ({:include-after
    [(juji.topics.interviewing.v4/*handle-user-response-default*
      ?q)]}),
  :include-after
  [(juji.topics.interviewing.v4/handle-interview-fallback ?q)]}
  [+]
  [ (<-| user-question (input-text)) "Thank you, I got your question!"]
  )

(deftopic
 ask-general-question_3
 [?q]
 [(>- user-question)]
 [(ask-question ?q (>- user-question))]
 (handle-ask-general-question_3 ?q))

(deftopic
 handle-ask-general-question_3
 [?q]
  [+]
  ["Thank you for your answer"]
)

ask-general-question_2 is used by “Do you have any questions you want to add?” topic, and ask-general-question_3 is used by “User’s question” topic.

  1. Save and compile your script, then run it. You shall get some conversation like the following:

For another, How to increase custom actions?

The custom action from the documentation has changed its name to Custom Response. You can add custom responses using the following button in each topic.


In addition, is it possible for me to invite you to be my coauthor to help me revise and discuss the details of the paper? Look forward your reply

Thank you for the invitation and recognizing Juji in your research. Regarding research cooperation please email hello@juji.io

Hi
Thank you again for your reply.
The user selects three questions and specifies the order of the questions, and then the chatbot can throw the questions at once according to the order specified by the user. How does this work? Can you give me an example? For example, when buying goods, the user pays the most attention to size, then color, and finally style. The user first defines the order of the three, and then the robot gives questions about size, color and style in turn. As the order changes, so does the order in which questions are asked. Looking forward to your reply!

One way is to extend the method above with three User’s Question topic (e.g., “User’s Question 1”, “User’s Question 2” and “User’s Question 3”). At the beginning, you elicit the users preference of question 1, 2, and 3 and save them in three variables (e.g., user-question-1, user-question-2, user-question-3). Then, you can replace the three User’s Question with the saved variables e.g., [(ask-question ?q (>- user-question-1))] etc. In this way, you not only control the ordering, you also control the wording of the three questions.

Could you provide the IDE code and renderings for this solution? Thank you very much

Could you provide the IDE code and renderings for this solution? Thank you very much

So something like the following ( ask-general-question_4 and T3 is not used, please ignore):

(deftopic ask-general-question_2
 [?q]
 []
 [(ask-question ?q)]
 (handle-ask-general-question_2 ?q))

(deftopic handle-ask-general-question_2
 [?q]
 {:default-rules
  ({:include-after
    [(juji.topics.interviewing.v4/*handle-user-response-default*
      ?q)]}),
  :include-after
  [(juji.topics.interviewing.v4/handle-interview-fallback ?q)]}
  [+]
  [ (<-| user-question-1 (input-text)) "Thank you, I got your first question!"]
  )

(deftopic ask-general-question_3
 [?q]
 []
 [(ask-question ?q)]
 (handle-ask-general-question_3 ?q))

(deftopic handle-ask-general-question_3
 [?q]
 {:default-rules
  ({:include-after
    [(juji.topics.interviewing.v4/*handle-user-response-default*
      ?q)]}),
  :include-after
  [(juji.topics.interviewing.v4/handle-interview-fallback ?q)]}
  [+]
  [ (<-| user-question-2 (input-text)) "Thank you, I got your second question!"]
  )

(deftopic ask-general-question_5
 [?q]
 []
 [(ask-question ?q)]
 (handle-ask-general-question_5 ?q))

(deftopic handle-ask-general-question_5
 [?q]
 {:default-rules
  ({:include-after
    [(juji.topics.interviewing.v4/*handle-user-response-default*
      ?q)]}),
  :include-after
  [(juji.topics.interviewing.v4/handle-interview-fallback ?q)]}
  [+]
  [ (<-| user-question-3 (input-text)) "Thank you, I got your third question!"]
  )

(deftopic ask-general-question_6
 [?q]
 [(>- user-question-1)]
 [(ask-question ?q (>- user-question-1))]
 (handle-ask-general-question_6 ?q))

(deftopic handle-ask-general-question_6
 [?q]
  [+]
  ["Thank you for your answer"]
)

(deftopic ask-general-question_7
 [?q]
 [(>- user-question-2)]
 [(ask-question ?q (>- user-question-2))]
 (handle-ask-general-question_7 ?q))

(deftopic handle-ask-general-question_7
 [?q]
  [+]
  ["Thank you for your answer"]
)

(deftopic ask-general-question_8
 [?q]
 [(>- user-question-3)]
 [(ask-question ?q (>- user-question-3))]
 (handle-ask-general-question_8 ?q))

(deftopic handle-ask-general-question_8
 [?q]
  [+]
  ["Thank you for your answer"]
)

which ends up with something like the following:



Meanwhile, you can add your predefined questions through some custom function in the script:

(defn key2question
  [k]
  (case k
        "size" "What's the size?"
        "color" "What's the color?"
        "style" "What's the style?"))

(deftopic
 ask-general-question_6
 [?q]
 [(>- user-question-1)]
 [(ask-question ?q (key2question (>- user-question-1)))]
 (handle-ask-general-question_6 ?q))

(deftopic
 handle-ask-general-question_6
 [?q]
  [+]
  ["Thank you for your answer"]
)

Which will produce the following:

You can also make T1, T2 and T4 into choice questions depending on your conversation design.

Thanks for your reply
Can I use a specific phrase to redirect the conversation to a specific question? In addition, when I re-enter a section, the chatbot can remember which part of the question the user just answered and continue to ask questions. For example, I want to buy a jacket, shoes and pants. They have three properties, size, size and color. After filling in the color of the coat, I want to fill in the color of the shoes, and then answer the part of the coat again. I just need to fill in the size and size. I want to get a concrete example of the IDE. Thank you very much!

Can I use a specific phrase to redirect the conversation to a specific question?

Yes, you don’t need IDE for this actually, in the design page, you can use the “Jump to Topic” action in the custom response like the example below:

The conversation will get redirect to topic T2 if the custom response trigger is triggered.


In addition, when I re-enter a section, the chatbot can remember which part of the question the user just answered and continue to ask questions. For example, I want to buy a jacket, shoes and pants. They have three properties, size, size and color. After filling in the color of the coat, I want to fill in the color of the shoes, and then answer the part of the coat again. I just need to fill in the size and size. I want to get a concrete example of the IDE. Thank you very much!

This is an interesting use case. However, I am not sure how you imagine the conversation should look like especially during the transition between the coat and shoes questions? Can you give a conversation example between the chatbot and the user?