npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@idems/idems_translation_chatbot

v1.0.18

Published

Translation tools for chatbots

Downloads

37

Readme

Chatbot translation tools

Getting started

Install latest Long-Term Support (LTS) release of Node.js.

Install project dependencies.

npm install

Running the scripts

The overall process is visualised in a flowchart.

has_any_words_check

Identify and fix possible errors in 'has_any_words' arguments.

node index has_any_words_check <rapidpro-json-file> <output-dir>

overall_integrity_check

Look for errors in arguments and in the link between QR and Arguments.

node index overall_integrity_check <rapidpro-json-file> <output-dir>

extract

Extract English-language strings from RapidPro flows, for translation.

node index extract <rapidpro-json-file> <output-dir>

localize

Merge translated strings back into original flow as a localization.

node index localize <input-rapidpro-flow-file> <translated-strings-file> <language-code> <output-name> <output-dir>

fix_arg_qr_translation

Look for errors in the link between QR and Arguments that have been introduced during translation and apply an auto-fix.

node index fix_arg_qr_translation <rapidpro-json-file> <output-dir> <file-output-name> <log-output-name>

move_quick_replies

Move quick replies to message text.

node index move_quick_replies <input-rapidpro-flow-file> <select_phrases> <output_name> <output-dir> <add_selectors> <qr_limit> <special_words>
  • add_selectors is either "yes" or "no", depending on whether you want to add the numerical quick replies back in. Example input: "yes".
  • qr_limit is an integer. A limit on the number of quick replies you want to add back in. If we are above the limit the add_selectors behaviour will be ignored and the quick replies will not be added back in.
  • special_words is a path to JSON file which has a list of words which will be reinstated as full quick replies as opposed to numbers. The words should be organised by language, an example of the file can be found in test/Input/special_words.json. This file can be reviewed for info but should not be modified as it is part of the test script.

reformat_quick_replies

Reformat quick replies.

node index reformat_quick_replies <input-rapidpro-flow-file> <select_phrases> <output_name> <output-dir> <count_threshold> <length_threshold> <qr_limit> <special_words>
  • count_threshold and length_threshold are integers. If the count of quick_replies is greater than count_threshold or the longest quick reply is greater than length_threshold, then the quick replies will be replaced with numerical prompts.
  • qr_limit is an integer. A limit on the number of quick replies you may want to add back in after they have been replaced with numerical prompts. If count_threshold and qr_limit are exceeded, the node message will be replaced with numerical prompts but those prompts will not be added as quick replies.
  • special_words is a path to a JSON file which has a list of words which will be reinstated as full quick replies as opposed to numbers. The words should be organised by language, an example of the file can be found in test/Input/special_words.json. This file can be reviewed for info but should not be modified as it is part of the test script.

convert_qr_to_html

Convert Quick Replies to HTML in message text.

node index convert_qr_to_html <input-rapidpro-flow-file> <output_name> <output-dir>

Running tests

npm test