New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@picovoice/orca-node-demo

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@picovoice/orca-node-demo - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

6

package.json
{
"name": "@picovoice/orca-node-demo",
"version": "1.0.1",
"version": "1.0.2",
"description": "Picovoice Orca Node.js file-based and streaming demos",

@@ -24,4 +24,4 @@ "scripts": {

"dependencies": {
"@picovoice/orca-node": "=1.0.0",
"@picovoice/pvspeaker-node": "^1.0.1",
"@picovoice/orca-node": "=1.0.1",
"@picovoice/pvspeaker-node": "^1.0.2",
"commander": "^6.1.0",

@@ -28,0 +28,0 @@ "prettier": "^2.6.2",

@@ -12,3 +12,3 @@ # Orca Streaming Text-to-Speech Demos

- Cross-Platform:
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64)
- Android and iOS

@@ -21,3 +21,3 @@ - Chrome, Safari, Firefox, and Edge

- Node.js 16+
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), and Raspberry Pi (3, 4, 5).
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).

@@ -24,0 +24,0 @@ ## Installation

@@ -68,2 +68,27 @@ #! /usr/bin/env node

program.parse(process.argv);
function splitText(text) {
// TODO: Remove once tiktoken supports windows-arm64
if (os.platform() === 'win32' && os.arch() === 'arm64') {
const ALPHA_NUMERIC = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '
const PUNCTUATION = '!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~ '
const tokensRaw = [ text[0] ]
for (let i = 1; i < text.length; i++) {
let ch = text[i];
let token = tokensRaw[tokensRaw.length - 1];
if ((ALPHA_NUMERIC.includes(ch) && !ALPHA_NUMERIC.includes(token[token.length - 1])) || PUNCTUATION.includes(ch)) {
tokensRaw.push(ch);
} else {
tokensRaw[tokensRaw.length - 1] += ch;
}
}
return tokensRaw;
} else {
const textDecoder = new TextDecoder();
const encoder = tiktoken.encoding_for_model('gpt-4');
const tokensRaw = Array.from(encoder.encode(text), e => textDecoder.decode(encoder.decode([e])));
encoder.free();
return tokensRaw;
}
}

@@ -78,12 +103,8 @@ function tokenizeText(text) {

const encoder = tiktoken.encoding_for_model('gpt-4');
const tokensRaw = Array.from(encoder.encode(text), e => encoder.decode([e]));
encoder.free();
const tokensRaw = splitText(text);
let customPron = '';
const tokensWithCustomPronunciations = [];
const textDecoder = new TextDecoder();
tokensRaw.forEach((t, i) => {
const token = textDecoder.decode(t);
tokensRaw.forEach((token, i) => {
let inCustomPron = false;

@@ -90,0 +111,0 @@ customPronunciations.forEach(pron => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc