How to use the thingtalk.TokenizerService function in thingtalk

To help you get started, we’ve selected a few thingtalk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stanford-oval / almond-cloud / scripts / import_turking.js View on Github external
function main() {
    const isPermission = process.argv[3] === 'permissions';
    const typePrefix = process.argv[2];
    if (!typePrefix)
        throw new Error('Must specify the type of dataset (eg turking1 or policy2 or setup2)');
    const testProbability = parseFloat(process.argv[4]) || 0.1;
    const devProbability = testProbability;

    const schemas = new ThingTalk.SchemaRetriever(new AdminThingpediaClient(_language), null, true);
    const tokenizerService = new ThingTalk.TokenizerService(_language);

    const rejects = csv.stringify({ header: true, delimiter:'\t' });
    rejects.pipe(fs.createWriteStream(typePrefix + '-rejects.tsv'));

    db.withTransaction((dbClient) => {
        let promises = [];

        const parser = csv.parse({ columns: true, delimiter: '\t' });
        process.stdin.pipe(parser);

        return Q.Promise((callback, errback) => {
            parser.on('data', (row) => {
                //console.log(row);
                let {id,thingtalk,paraphrase} = row;
                //let [,utterance,tt] = row;
                let testTrain = '';