Python command: Text Evaluator

Use the Text Evaluator commands in Python to compare note text with standard responses to make sure that operators are entering legitimate notes. See Python commands for other commands you can use with GainSeeker.

Before using these commands, you must create a .csv file for each distinct set of "standard" notes, with one note on each row of the file. GainSeeker will read the note text from the first column of that .csv file and ignore any subsequent columns. This set of notes is sometimes referred to as a "Training set".

You may want to create multiple sets (.csv files) - for example, one set of "good" notes and one set of "bad" notes.

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

textevaluator.addtoset(setname, text)

 

Adds the text to the given set in the text evaluator and in the set's CSV file.

setname must be a set that has already been loaded into the text evaluator using textevaluator.loadset (below).

This returns True if successful and throws an exception otherwise.

9.2

textevaluator.evaluateagainstnotes(text, includenote=False)

 

Evaluates the text against all notes from all sets in the text evaluator, and returns the score for the top 10 most similar notes.

This returns a list of lists, where:

  • Each sub-list is comprised of :
    1. the set name

    2. the probability (from 0 to 100) that the text is similar to a specific note

    3. (if includenote = True) the text of that specific note

  • The list is ordered by probability in descending order.

9.2

textevaluator.evaluateagainstsets(text)

 

Evaluates the text against all notes from all sets in the text evaluator, and returns the probability of this text belonging to each set.

This returns a list of lists, where:

  • Each sub-list is comprised of :
    1. the set name

    2. the probability (from 0 to 100) that the text belongs to that set

  • The list is ordered by probability in descending order.

9.2

textevaluator.loadset(setname, filepath)

 

Loads the .csv file referenced by filepath into the text evaluator and labels it as setname.

This returns the setname if the operation was successful.

9.2

textevaluator.reset()

 

Clears all sets from the text evaluator.

This does not modify any .csv files.

This returns True if successful and throws an exception otherwise.

9.2

textevaluator.sets

 

Returns a list of all set names currently loaded into the text evaluator.

9.2

 

Example scripts can be downloaded from the Python Script Library.

See also: login.rtfstrs