Giter Site home page Giter Site logo

text-analyzer's Introduction

text-analyzer

node express

This project implements an api endpoint with express to analyze a raw data requests. Requests should be sent to the endpoint as plaintext encoded in UTF-8. Successful requests will yield a JSON response that contains:

  1. The top 50 most frequently used words along with their frequency. Punctuation and case are ignored during comparison.

  2. The total word count of the document.

  3. The percentage of characters in the document that are whitespace.

  4. The percentage of characters in the document that are punctuation marks.

Installation and usage

To install clone the repo and install the dependencies with:

npm install

Then run the server with:

npm server.js

Then send your requests to http://localhost:3000/analyze using post, ensuring the charset is utf-8 and the Content-Type is text/plain. Requests with different types will be rejected by the server. Valid requests will yield a JSON response containing the results of the text analysis.

A nice tool to easily test API endpoints I'd recommend is Insomnia.

insomnia screenshot

Limitations

Currently there is no hardcoded limit for how big requests can be. However, the entire request must be loaded into memory for analysis so care should be taken to during deployment to ensure the server prevents requests that are too large to handle by setting a cap in nginx, for example.

text-analyzer's People

Contributors

karolat avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.