kerryrodden / tiny-tfidf

Minimal implementations of a couple of classic text analysis tools (TF-IDF and cosine similarity)
MIT License
56 stars 13 forks source link

Compile as UMD bundle suggestion #2

Open radames opened 4 years ago

radames commented 4 years ago

Hi, This is a great project, thanks! I've been playing with it using Observables. A proof of concept of in browser text analysis of youtube captions, is still in progress not yet published

As I'm using webworkers to run UMAP and tiny-tfidf. I came across the problem that ES6 module is not yet default supported in browser. Observables do some magic to import even without browser support.

If you're interested I've bundle the library using rollup on this commit branch https://github.com/radames/tiny-tfidf/commit/fe3af6964967202baeeedcc6a3ed494ad5fb4fb2 I can pull request

Therefore you can import using script tag, or in my case importScripts to run as a web worker

  <script src="https://cdn.jsdelivr.net/gh/radames/tiny-tfidf@dist/tiny-tfidf.min.js" defer></script>

or

importScripts("https://cdn.jsdelivr.net/gh/radames/tiny-tfidf@dist/tiny-tfidf.min.js");
kerryrodden commented 4 years ago

Thank you for the suggestion, and yeah, this is definitely a need! I will take a look. BTW I'm sorry for my delayed response - I am having some trouble receiving notifications from Github, and just saw the issue now.

radames commented 4 years ago

Hi, no worries! I've been testing it on my observables notebook all in browser and seems to be working fine. Plz let me know if you want a pull request. cheers

squares-ui commented 4 years ago

And +1 vote for a native JS implementation

I would LOVE to include a TSNE/TFIDF visual in a project I work on, unfortunately the project is purely client side. Reversing NPM isn't my strong point :)

Andy