sgsinclair / Voyant

GNU General Public License v3.0
207 stars 53 forks source link

Remove NaN values from JSON responses #516

Open ajmacdonald opened 3 years ago

ajmacdonald commented 3 years ago

Some tool results can contain NaN as a value, which is not valid JSON. Using fetch to call these tools causes an error when response.json() fails.

Some tools where this can occur: CorpusTerms, CorpusTermCorrelations.

CorpusTerm sets the comparisonRelativeFreqDifference to 0 if it is NaN. Should we do this for the other occurrences as well?

ajmacdonald commented 3 years ago

Maybe it makes more sense to return null instead.

ajmacdonald commented 3 years ago

Also need to remove Infinity. This can occur in the CA/PCA/TSNE analysis tools.