<commit_before>// OV1 Interface
var log4js = require('log4js');
var SerialPort;
if (process.env.simulation == 'true') {
    SerialPort = require('virtual-serialport');
}
else {
    SerialPort = require('serialport'); 115200
}

var OVPort = function () {
    this.active = false;
    this.portName = '/dev/ttyAMA0';
    this.settings = { baudrate: 115200, databits: 8, stopbits: 1, parity: 'none' };
    this.serialPort = {};
    this.message = {}
    this.timeout = 0;
    this.log = {};
    this.listeners = [];
    this.complete = [];
    this.writeString = '';
    this.readString = '';
}

OVPort.constructor = OVPort
OVPort.prototype = {

    // var config = { log: {}};
    Start: function (config, complete) {
        console.log("in Input");
        try {
            this.log = config.log;
            this.complete.push(complete);
            this.serialPort = new SerialPort(config.portName, this.settings);
            var pThis = this;
            this.serialPort.on('data', function (data) {
                console.log('serial data: ' + data)
                // Add data to buffer
                pThis.readString += data<commit_msg>Process incoming ascii string<commit_after>// OV1 Interface
var log4js = require('log4js');
var SerialPort;
if (process.env.simulation == 'true') {
    SerialPort = require('virtual-serialport');
}
else {
    SerialPort = require('serialport'); 115200
}

var OVPort = function () {
    this.active = false;
    this.portName = '/dev/ttyAMA0';
    this.settings = { baudrate: 115200, databits: 8, stopbits: 1, parity: 'none' };
    this.serialPort = {};
    this.message = {}
    this.timeout = 0;
    this.log = {};
    this.listeners = [];
    this.complete = [];
    this.writeString = '';
    this.readString = '';
}

OVPort.constructor = OVPort
OVPort.prototype = {

    // var config = { log: {}};
    Start: function (config, complete) {
        console.log("in Input");
        try {
            this.log = config.log;
            this.complete.push(complete);
            this.serialPort = new SerialPort(config.portName, this.settings);
            var pThis = this;
            this.serialPort.on('data', function (data) {
                console.log('serial data: ' + data.toString('ascii'))
                // Add data to buffer
                pThis.readString += data.toString('ascii')
{'fraction_non_alphanumeric': 0.1483375959079284, 'fraction_numerical': 0.01619778346121057, 'mean_word_length': 2.343304843304843, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '383557', 'n_tokens_mistral': 755, 'n_tokens_neox': 701, 'n_words': 156}