Skip to content

Commit 5b0c613

Browse files
committed
fix typos (#59)
1 parent fcbef8a commit 5b0c613

File tree

7 files changed

+64
-81
lines changed

7 files changed

+64
-81
lines changed

README.md

Lines changed: 38 additions & 64 deletions
Large diffs are not rendered by default.

examples/node.cjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,13 @@ const items = ['alice', 'bob']
1111
const errorRate = 0.04 // 4 % error rate
1212
filter = bfs.BloomFilter.create(items.length, errorRate)
1313
filter = bfs.BloomFilter.from(items, errorRate)
14-
bfs.BloomFilter.fromJSON(filter.saveAsJSON())
14+
bfs.BloomFilter.fromJSON(filter.saveAsJSON())
15+
16+
bfs.Hashing.lib = {
17+
xxh64: (x, _) => 1n,
18+
xxh128: (x, _) => 1n,
19+
}
20+
filter._hashing._lib = bfs.Hashing.lib
21+
const hashes = filter._hashing.hashTwice('x')
22+
assert(hashes.first === 1n)
23+
assert(hashes.second === 1n)

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
"import": "./dist/module/dist/counting-bloom-filter.js",
3939
"require": "./dist/commonjs/dist/counting-bloom-filter.js"
4040
},
41-
"./partitionned-filter.js": {
42-
"import": "./dist/module/dist/partitionned-bloom-filter.js",
43-
"require": "./dist/commonjs/dist/partitionned-bloom-filter.js"
41+
"./partitioned-filter.js": {
42+
"import": "./dist/module/dist/partitioned-bloom-filter.js",
43+
"require": "./dist/commonjs/dist/partitioned-bloom-filter.js"
4444
},
4545
"./scalable-filter.js": {
4646
"import": "./dist/module/dist/scalable-bloom-filter.js",
@@ -123,7 +123,7 @@
123123
"test:module": "node examples/node.mjs",
124124
"test:lint-build": "yarn lint && yarn build",
125125
"test": "yarn test:lint-build && yarn test:commonjs && yarn test:module && jest",
126-
"doc": "typedoc --sort alphabetical --out docs/ --emit both --includeVersion src/index.ts",
126+
"doc": "typedoc --sort alphabetical --out docs/ --emit both --includeVersion src/**/*.ts",
127127
"clean": "rimraf docs/ dist/module/dist dist/commonjs/dist dist/website/rspack dist/website/webpack"
128128
},
129129
"repository": {
@@ -136,7 +136,7 @@
136136
"bloom filter",
137137
"probabilistic",
138138
"datastructure",
139-
"partitionned bloom filter",
139+
"partitioned bloom filter",
140140
"scalable bloom filter",
141141
"counting bloom filter",
142142
"invertible bloom filter",

src/count-min-sketch.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default class CountMinSketch extends BaseFilter implements CountingFilter
9595
/**
9696
* Update the count min sketch with a new occurrence of an element
9797
* @param element - The new element
98-
* @param count - Number of occurences of the elemnt (defauls to one)
98+
* @param count - Number of occurrences of the elemnt (defauls to one)
9999
*/
100100
public update(element: HashableInput, count = 1): void {
101101
this._allSums += count
@@ -106,9 +106,9 @@ export default class CountMinSketch extends BaseFilter implements CountingFilter
106106
}
107107

108108
/**
109-
* Perform a point query: estimate the number of occurence of an element
109+
* Perform a point query: estimate the number of occurrence of an element
110110
* @param element - The element we want to count
111-
* @return The estimate number of occurence of the element
111+
* @return The estimate number of occurrence of the element
112112
*/
113113
public count(element: HashableInput): number {
114114
let min = Infinity

src/interfaces/counting-filter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/**
2-
* A filter that can count occurences of items and estimate their frequencies.
2+
* A filter that can count occurrences of items and estimate their frequencies.
33
* @author Thomas Minier
44
* @author Arnaud Grall
55
*/
66
export default interface CountingFilter<T> {
77
/**
88
* Update the count min sketch with a new occurrence of an element
99
* @param element - The new element
10-
* @param count - Number of occurences of the elemnt (defauls to one)
10+
* @param count - Number of occurrences of the elemnt (defauls to one)
1111
*/
1212
update(element: T, count: number): void
1313

1414
/**
15-
* Perform a point query: estimate the number of occurence of an element
15+
* Perform a point query: estimate the number of occurrence of an element
1616
* @param element - The element we want to count
17-
* @return The estimate number of occurence of the element
17+
* @return The estimate number of occurrence of the element
1818
*/
1919
count(element: T): number
2020
}

src/scalable-bloom-filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export default class ScalableBloomFilter
176176
}
177177

178178
/**
179-
* Create a Scalable Bloom Filter based on Partitionned Bloom Filter.
179+
* Create a Scalable Bloom Filter based on Partitioned Bloom Filter.
180180
* @param _size the starting size of the filter
181181
* @param _error_rate ther error rate desired of the filter
182182
* @param _ratio the tightening ration

tests/hyperloglog.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test('should support update and cardinality estimations (count) operations', ()
3636
)
3737
}
3838
})
39-
test('should peforms the union of two HyperLogLog sketches', () => {
39+
test('should performs the union of two HyperLogLog sketches', () => {
4040
const first = new HyperLogLog(2 ** 4)
4141
const second = new HyperLogLog(2 ** 4)
4242
first.update('alice')
@@ -115,10 +115,10 @@ test('issue#(https://github.com/Callidon/bloom-filters/issues/69)', () => {
115115
const sketch = new HyperLogLog(128)
116116
// push 10000 distinct elements
117117
const n = 2 ** 14
118-
for (let i = 0; i<n; i++) {
118+
for (let i = 0; i < n; i++) {
119119
sketch.update(i.toString())
120120
}
121121
// count occurrences
122122
expect(sketch.relative_error()).toEqual(1.04 / Math.sqrt(128))
123123
expect(n - sketch.count()).toBeLessThan(n * sketch.relative_error() * 3)
124-
})
124+
})

0 commit comments

Comments
 (0)