Skip to content

Instantly share code, notes, and snippets.

View johanneskropf's full-sized avatar

Johannes Kropf johanneskropf

View GitHub Profile
@johanneskropf
johanneskropf / README.md
Last active September 8, 2021 07:51
simple jsgf permutator subflow

About

This subflow can parse all possible sentences / permutations from a jsgf grammar file and output them as an array of sentences. This can for example be useful to quickly generate a text corpus to train a language model for a speech recognition system like Deepspeech or Kaldi. It can also be used to rig a simple nlu / intent recognition system together with node-red-contrib-fuzzywuzzy. This is done by adding tags to the jsgf grammar and than choosing move tags to the left in the subflow menu. This subflow only uses function nodes and has zero dependencies.

Usage

To create all possible sentences pass in the jsgf file content as a string in the msg.payload. The subflow will than output all permutations of the public rule sentences described by the grammar as an array of sentences in the msg.payload. It can also be configured to output the sentences as a single string with one sentence per line. This output will be to the first output of the subflow.

Tags

If you grammar includes tags you can ch