Skip to content

Commit

Permalink
doin well
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermountain committed Feb 2, 2023
1 parent f3e9b83 commit 08b1039
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
13 changes: 8 additions & 5 deletions scratch.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { learn, test, reverse, convert, compress } from './src/index.js'
import summarize from './scripts/summarize.js'
import pairs from '/Users/spencer/mountain/suffix-thumb/tests/data/fr-words.js' //0.3kb
// import pairs from '/Users/spencer/mountain/suffix-thumb/tests/data/fr-words.js' //0.3kb
// import pairs from '/Users/spencer/mountain/suffix-thumb/tests/data/future-simple.js' //1.6kb
// import pairs from '/Users/spencer/mountain/suffix-thumb/tests/data/fr-nous.js' //4.5kb
import pairs from '/Users/spencer/mountain/suffix-thumb/tests/data/fr-nous.js' //4.5kb


let opts = {
// threshold: 0.8,
// min:2,
threshold: 70,
min: 2,
// reverse: true
}

let model = learn(pairs, opts)
// model.ex = {}
// console.log(compress(model))
// console.log(reverse(model))
console.log(summarize(model))
console.log(model)
summarize(model)
test(pairs, model)
14 changes: 8 additions & 6 deletions src/learn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ const learn = function (pairs, opts = {}) {
// console.log(pending.length, 'pending fwd')
// console.log(pendingBkwd.length, 'pending Bkwd')
// add anything remaining as an exception
pending.forEach(arr => {
ex[arr[0]] = arr[1]
})
pendingBkwd.forEach(arr => {
ex[arr[1]] = arr[0]
})
if (opts.min <= 1) {
pending.forEach(arr => {
ex[arr[0]] = arr[1]
})
pendingBkwd.forEach(arr => {
ex[arr[1]] = arr[0]
})
}
return {
fwd,
both,
Expand Down

0 comments on commit 08b1039

Please sign in to comment.