Skip to main content

Analysis of N-gram in a set of messages

Project description

Take NGram

TakeNGram is a tool to provide analysis of n-grams in a dataset of messages.

The recommendation usage is with the InsightExtractor Cloud CSV output.

The analysis consists in creation of a dictionary with the n-grams of all messages and their respective frequency. Besides the creation of word cloud of the n-grams.

All analysis can be made in a group of sentences of a subject (most useful with the Insight Extractor output).

Overview

Installation

The take_ngram package cab be installed from PyPI.

pip install take_ngram

Usage

For usage the file must have to be a CSV file.

All the examples are based on the Insight Extractor output.

  1. Creating a BiGram of the sentences and get the WordCloud.
from take_ngram import NGram
bigram = NGram('file.csv',
               'Structured Message')
bigram.get_word_cloud()
  1. Creating a BiGram of the sentences and saving the WordCloud.
from take_ngram import NGram
bigram = NGram('teste.csv', 
               'Structured Message')
bigram.get_word_cloud(file_path='image.png')
  1. Adding stop words
from take_ngram import NGram
bigram = NGram('file.csv', 
               'Structured Message',
                stop_words = ['segunda'])
bigram.get_word_cloud(file_path='image.png')
  1. Removing prepositions from stop words
  • By default prepositions are added to the stop words
from take_ngram import NGram
bigram = NGram('file.csv', 
               'Structured Message', 
               remove_prepositions=False)
bigram.get_word_cloud(file_path='image.png')
  1. Making n-grams for some specific subjects.
from take_ngram import NGram
bigram = NGram('file.csv', 
                'Structured Message', 
                subject_column = 'Groups', 
                subject_list = ['fatura','plano'])
bigram.get_word_cloud(file_path='image.png')

Author

Take Blip Data&Analytics Research

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

take_ngram-0.1.1.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

take_ngram-0.1.1-py3-none-any.whl (8.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page