aceade / sydfjords

A practice project to teach myself responsive design with Vue
https://aceade.github.io/sydfjords/
MIT License
0 stars 0 forks source link

Change sentiment analysis library #59

Closed aceade closed 7 months ago

aceade commented 7 months ago

ml5 has numerous vulnerable dependencies, and the developers have decided to create a next-gen version. However, that isn't ready yet.

Alternatively, directly use the Sentiment Analysis task from Tensorflow.js.

aceade commented 7 months ago

The perennial curse of frontend development: trying to figure out what a gibberish Vite/npm/whatever stack trace means.

Failed to resolve entry for package "@tensorflow-models/tasks". The package may have incorrect main/module/exports specified in its package.json. 09:55:08 [vite] Internal server error: Failed to resolve entry for package "@tensorflow-models/tasks". The package may have incorrect main/module/exports specified in its package.json. Plugin: vite:import-analysis File: path/to/sydfjords/src/sentiment/sentiment.ts at packageEntryFailure (path/to/sydfjords/nodemodules/.pnpm/vite@4.5.2@types+node@20.11.17/node_modules/vite/dist/node/chunks/dep-52909643.js:28725:11) at resolvePackageEntry (path/to/sydfjords/nodemodules/.pnpm/vite@4.5.2@types+node@20.11.17/node_modules/vite/dist/node/chunks/dep-52909643.js:28722:5) at tryNodeResolve (path/to/sydfjords/nodemodules/.pnpm/vite@4.5.2@types+node@20.11.17/node_modules/vite/dist/node/chunks/dep-52909643.js:28453:20) at Context.resolveId (path/to/sydfjords/nodemodules/.pnpm/vite@4.5.2@types+node@20.11.17/node_modules/vite/dist/node/chunks/dep-52909643.js:28212:28) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.resolveId (path/to/sydfjords/nodemodules/.pnpm/vite@4.5.2@types+node@20.11.17/node_modules/vite/dist/node/chunks/dep-52909643.js:44276:32) at async TransformContext.resolve (path/to/sydfjords/nodemodules/.pnpm/vite@4.5.2@types+node@20.11.17/node_modules/vite/dist/node/chunks/dep-52909643.js:43992:23) at async normalizeUrl (path/to/sydfjords/nodemodules/.pnpm/vite@4.5.2@types+node@20.11.17/node_modules/vite/dist/node/chunks/dep-52909643.js:41836:34) at async path/to/sydfjords/nodemodules/.pnpm/vite@4.5.2@types+node@20.11.17/node_modules/vite/dist/node/chunks/dep-52909643.js:41998:47 at async Promise.all (index 0)

aceade commented 7 months ago

The issue seems to be with the @tensorflow-models/tasks package. Loading the @tensorflow-models/toxicity package works fine.

This seems to be a more specific form of sentiment analysis than what I was expecting - it checks for toxicity (insults, threats, obscenity). That might be more useful than a generic "is this a positive message?"