{"_id":"@basementuniverse/tf-idf","_rev":"2-51cb21fc813c0306d47473bff270b54a","name":"@basementuniverse/tf-idf","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@basementuniverse/tf-idf","version":"0.0.1","description":"Search for terms in array of documents using TF-IDF","main":"build/index.js","scripts":{"build":"tsc","test":"jest"},"keywords":["tf-idf","tfidf","search","find","rank"],"author":{"name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com","url":"https://gordonlarrigan.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/basementuniverse/tf-idf.git"},"devDependencies":{"@types/jest":"^29.5.10","jest":"^29.7.0","ts-jest":"^29.1.1","typescript":"^5.3.2"},"gitHead":"c0df233c1891dd9ff6811bce62ad86bdd2c9a57a","bugs":{"url":"https://github.com/basementuniverse/tf-idf/issues"},"homepage":"https://github.com/basementuniverse/tf-idf#readme","_id":"@basementuniverse/tf-idf@0.0.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-wBvduP8eE6SeazBCP+j8uzufCnXxWr2QYyuB+ANG20i3Bd4WwKkoZpC6glw6UWe1nki7ZTS90CS9wUYqePCgIg==","shasum":"c7efdcf4f1e2f324cb98c7559c1cc4b315e1c68e","tarball":"https://registry.npmjs.org/@basementuniverse/tf-idf/-/tf-idf-0.0.1.tgz","fileCount":4,"unpackedSize":3066,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGTTTaEJe7bW2wQ7seqh0SrhKWgKl056Ob1rojkmPBLfAiBvAmy+4TC7lpRzoeOHqv1qCceSqPw6CDFOXQVP0DfB7A=="}]},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"directories":{},"maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tf-idf_0.0.1_1700988883174_0.7701599537691244"},"_hasShrinkwrap":false},"0.0.2":{"name":"@basementuniverse/tf-idf","version":"0.0.2","description":"Search for terms in array of documents using TF-IDF","main":"build/index.js","scripts":{"build":"tsc","test":"jest"},"keywords":["tf-idf","tfidf","search","find","rank"],"author":{"name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com","url":"https://gordonlarrigan.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/basementuniverse/tf-idf.git"},"devDependencies":{"@types/jest":"^29.5.10","jest":"^29.7.0","ts-jest":"^29.1.1","typescript":"^5.3.2"},"types":"./build/index.d.ts","gitHead":"ced7432fc16526c94a59098d01d730c835e23944","bugs":{"url":"https://github.com/basementuniverse/tf-idf/issues"},"homepage":"https://github.com/basementuniverse/tf-idf#readme","_id":"@basementuniverse/tf-idf@0.0.2","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-eziZ5SxNFvyo4UAXBeLwrVXMKAfUPEiYrVCMqrEokuUgiKGPReFBfYAuMRn+OwSsr+ehulr6Lt7oXmkuB3auvw==","shasum":"b9de71f1367270c4bf9df5fe99ae435a87a85322","tarball":"https://registry.npmjs.org/@basementuniverse/tf-idf/-/tf-idf-0.0.2.tgz","fileCount":6,"unpackedSize":5657,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDALP+TnMXPp8CQwbZV7ElH9Lws7ESjIRAh5IJ1PJMX9QIhAOUjuGQSZfZJaAjofF2jEuAwY9zC3OkT9JixxpAFTu8G"}]},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"directories":{},"maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tf-idf_0.0.2_1700989420519_0.7748682643857003"},"_hasShrinkwrap":false},"0.0.3":{"name":"@basementuniverse/tf-idf","version":"0.0.3","description":"Search for terms in array of documents using TF-IDF","main":"build/index.js","scripts":{"build":"tsc","test":"jest"},"keywords":["tf-idf","tfidf","search","find","rank"],"author":{"name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com","url":"https://gordonlarrigan.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/basementuniverse/tf-idf.git"},"devDependencies":{"@types/jest":"^29.5.10","jest":"^29.7.0","ts-jest":"^29.1.1","typescript":"^5.3.2"},"types":"./build/index.d.ts","gitHead":"cc6d6e305ca5300cf979cf3b4d71c48226f1039c","bugs":{"url":"https://github.com/basementuniverse/tf-idf/issues"},"homepage":"https://github.com/basementuniverse/tf-idf#readme","_id":"@basementuniverse/tf-idf@0.0.3","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-Un9W6VbbZZGdmEDY6urFaeeaThVHTGIH8RiKEEZSZ/32+qHCbD4VqcKPOBoDojWbK1pG6P80XdabvQz7Pzstpg==","shasum":"9d455f88f3aab2c197f9edd1262b32b1912e0151","tarball":"https://registry.npmjs.org/@basementuniverse/tf-idf/-/tf-idf-0.0.3.tgz","fileCount":6,"unpackedSize":5714,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD3pQnT2DoBnR31Rvt07Ss/u+yZ30GTuOTW+nbfgAhGsAIhAMI5xb9aeaaKSwg0zhSszy0xyTZQ91NB4kElFcu87QDk"}]},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"directories":{},"maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tf-idf_0.0.3_1701010975199_0.7546285479476991"},"_hasShrinkwrap":false}},"time":{"created":"2023-11-26T08:54:43.049Z","0.0.1":"2023-11-26T08:54:43.369Z","modified":"2023-11-26T15:02:55.609Z","0.0.2":"2023-11-26T09:03:40.731Z","0.0.3":"2023-11-26T15:02:55.408Z"},"maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"description":"Search for terms in array of documents using TF-IDF","homepage":"https://github.com/basementuniverse/tf-idf#readme","keywords":["tf-idf","tfidf","search","find","rank"],"repository":{"type":"git","url":"git+https://github.com/basementuniverse/tf-idf.git"},"author":{"name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com","url":"https://gordonlarrigan.com"},"bugs":{"url":"https://github.com/basementuniverse/tf-idf/issues"},"license":"MIT","readme":"# TF-IDF\n\nSearch for terms in an array of documents using [TF-IDF](https://en.wikipedia.org/wiki/Tf%E2%80%93idf).\n\n## Installation\n\n```\nnpm install -g @basementuniverse/tf-idf\n```\n\n## Usage\n\n```typescript\nimport { Corpus } from '@basementuniverse/tf-idf';\n\nconst corpus = new Corpus([\n  'This is a document',\n  'Here is another document',\n]);\n\nconst results = corpus.search('document');\n```\n\n`results` will look something like:\n\n```json\n[\n  {\n    \"document\": \"This is a document\",\n    \"score\": 0.5\n  },\n  {\n    \"document\": \"Here is another document\",\n    \"score\": 0.5\n  }\n]\n```\n\nThe documents passed into the `Corpus` constructor will be treated as strings by default, and will be converted to lowercase and split by non-word characters.\n\nHowever, it is possible to pass in values of any type here, as long as you provide a function to convert each value to an array of strings. For example:\n\n```typescript\nconst corpus = new Corpus(\n  [\n    {\n      id: '1234',\n      name: 'John Doe',\n    },\n    {\n      id: '2345',\n      name: 'Jane Doe',\n    },\n  ],\n  document => [document.id, ...document.name.toLowerCase().split(' ')],\n);\n```\n\nPartial term matching can be enabled by passing `true` as the second argument to `search()`:\n\n```typescript\nconst results = corpus.search('doe', true);\n```\n","readmeFilename":"README.md"}