-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-models.js
More file actions
25 lines (22 loc) · 979 Bytes
/
Copy pathverify-models.js
File metadata and controls
25 lines (22 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const fs = require('fs');
const path = require('path');
const { predictWithModel, preprocess } = require('./ml-predict');
async function main() {
const modelPath = path.join(__dirname, 'models', 'model_fr.json');
const model = JSON.parse(fs.readFileSync(modelPath, 'utf8'));
const texts = [
'Bonjour, nous proposons un poste de développeur avec un entretien et des missions claires.',
'Vous pouvez gagner rapidement de l’argent, envoyez votre RIB et votre pièce d’identité.',
'Nous vous proposons un contrat à distance avec un salaire attractif.',
'Urgent, envoyez votre passeport maintenant pour finaliser l’embauche.',
'Nous recherchons un profil pour le poste de commercial avec une offre intéressante.'
];
for (const text of texts) {
const prob = predictWithModel(text, model);
console.log(`${preprocess(text)}\n=> ${prob.toFixed(6)}\n`);
}
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});