Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of ThingEngine
//
// Copyright 2017 Silei Xu
//
// See COPYING for details
"use strict";
const path = require('path');
const fs = require('fs');
const csv = require('csv')
const ThingTalk = require('thingtalk');
const SEMPRESyntax = ThingTalk.SEMPRESyntax;
function main() {
var inp_format = process.argv[2];
var fin = path.join(process.argv[3], 'data.csv');
var fout = path.join(process.argv[3], 'data-sempre.csv');
var output = csv.stringify();
var parser = csv.parse();
var file = fs.createWriteStream(fout);
output.pipe(file);
fs.createReadStream(fin)
.pipe(parser)
.on('data', (row) => {
var tt = ThingTalk.Grammar.parse(row[1]);
var json = SEMPRESyntax.toSEMPRE(tt, false);
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of Thingpedia
//
// Copyright 2015 The Mobisocial Stanford Lab
//
// See COPYING for details
require('thingengine-core/lib/polyfill');
const Q = require('q');
const deq = require('deep-equal');
const db = require('../util/db');
const ThingTalk = require('thingtalk');
const SEMPRESyntax = ThingTalk.SEMPRESyntax;
const SchemaRetriever = require('./deps/schema_retriever');
const BATCH_SIZE = 100;
function normalizePrimitive(json) {
json.args.sort((a, b) => {
let aname = a.name.id;
let bname = b.name.id;
if (aname < bname)
return -1;
if (aname > bname)
return 1;
return 0;
});
json.args.forEach((a) => {
if (a.value.display === null)
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of Almond
//
// Copyright 2016 Giovanni Campagna
//
// See COPYING for details
"use strict";
const Q = require('q');
const ThingTalk = require('thingtalk');
const Ast = ThingTalk.Ast;
const Type = ThingTalk.Type;
const SEMPRESyntax = ThingTalk.SEMPRESyntax;
const Describe = ThingTalk.Describe;
const ValueCategory = require('./semantic').ValueCategory;
const Dialog = require('./dialog');
const ContactSearchDialog = require('./contact_search_dialog');
module.exports = class SetupDialog extends Dialog {
constructor() {
super();
this.person = null;
this.principal = null;
this.program = null;
this.reconstructed = null;
this.contactSearch = null;