Giter Club home page Giter Club logo

word-n-grams's Introduction

Word n-Grams

A simple script that scans a piece of text (a local file in the same location as the script, or a string literal enclosed in quotes) and displays the top k word n-grams (word sequences of length n) from the text, including their absolute and relative frequencies. For example, in the following sentence

"It is raining today, and I will need an umbrella."

the word 4-grams are "It is raining today", "is raining today and", "raining today and I", "and I will need", "I will need an", "will need an umbrella." Case and punctuation marks and ignored when comparing word grams, so that the word 4-grams "It is raining today," and "it is raining today" are considered the same.

An example:

The top 10 word 5-grams and their frequencies (absolute and relative) are as follows.

    it's important to be confident 4 (0.014)
    a photo is real or 4 (0.014)
    be confident and stand up 4 (0.014)
    photo is real or retouched 4 (0.014)
    important to be confident and 3 (0.01)
    idea of what beauty is 3 (0.01)
    confident and stand up to 3 (0.01)
    think words can never hurt 3 (0.01)
    to be confident and stand 3 (0.01)
    and stand up to bullies 3 (0.01)

word-n-grams's People

Contributors

sr-murthy avatar

Watchers

 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.