Sort your training sentences


With lot of training sentences in your intent, adding some over time, it become hard to know if you ever add same one, have some like the new one, etc.

Here is a little hack to get your training sorted alphabetically in your intent.

You first need a working python environement.

Create a folder with three files:

  • sentences.txt
  • sentencesOrdered.txt


  • On your intent, export training sentence, ctrlA+ctrlC
  • Past them in sentences.txt
  • Run the python script
  • ctrlA+ctrlC sentencesOrdered.txt
  • On the console, delete all training sentences, import, ctrlV

Here is the python script:

# -*- coding: utf-8 -*-

import sys, os
import io

with'sentences.txt', 'rt', newline='') as f:
    sentences = f.readlines()


newFile = ''
for sent in sentences:
	sent = sent.replace("\r\n", "\n")
	newFile += sent

open('sentencesOrdered.txt', 'w').write(newFile)



This functionality will be part of an upcoming console release, coming soon. :slight_smile:

(I realise your post is about a workaround, but as soon as we add support for this in the console itself, it won’t be needed anymore)


Thanks, actualy I make the job with openoffice and many copy paste and export import …


No problem, just a workaround.

Sorting dynamically in the console would be a lot better of course. alpha, counter alpha, pet slot etc…