Detox Data File
The data file consist of model weights, data objects, and settings that the Detox AI engine uses to parse text and detect toxicity. Download the latest set of files using the link below.
Version: 3.1.3
Release date: 2021-09-09
SHA-1: 5b8743b3df5d2efedf1c51278c8bc27fe860c4f2
Quick Start Guide
Sample code for loading the data file is provided below for supported languages. See our Overview documentation guide for further details.
Javascript
// Option 1: Loading data from file system const fs = require('fs') let detoxData = JSON.parse(fs.readFileSync('.../Detox_Data.json')); // Option 2: Fetching data as a hosted resource fetch('.../Detox_Data.json') .then(response => response.json()) .then(function (data) { let detoxData = data; // ... });
C#
// Option 1: Loading data from file system string detoxData = System.IO.File.ReadAllText(@".../Detox_Data.json"); // Option 2: Fetching data as a hosted resource using (var webClient = new System.Net.WebClient()) { string detoxData = webClient.DownloadString(dataURI); }
Unity (C#)
using UnityEngine; // Option 1: Fetching data as a TextAsset from Resources TextAsset detoxDataAsset = Resources.Load("detoxData"); string detoxData = detoxDataAsset.text; // Option 2: Read data directly from the JSON file System.IO.StreamReader reader = new System.IO.StreamReader(detoxDataPath); string detoxData = reader.ReadToEnd(); reader.Close();
Python
import json # Option 1: Loading data from file system detox_data = json.load(open('.../Detox_Data.json')) # Option 2: Fetching data as a hosted resource import urllib.request with urllib.request.urlopen(".../Detox_Data.json") as f: detox_data = json.loads(f.read().decode('utf-8'))
Lua
A third-party library is needed to parse JSON as Lua does not have out-of-the-box support for JSON.
local json = require "json" local function readall(filename) local fh = assert(io.open(filename, "rb")) local contents = assert(fh:read(_VERSION <= "Lua 5.2" and "*a" or "a")) fh:close() return contents end local detoxDataStr = readall('.../Detox_Data.json') local detoxData = json.decode(detoxDataStr)