Skip to main content

Insight Extractor Package

Project description

TakeBlipInsightExtractor Package

Data & Analytics Research

Overview

Here is presented these content:

  • [Intro]
  • [Run]
  • [Example of initialization e usage]

Intro

The Insight Extractor offers a way to analyze huge volumes of textual data in order to identify, cluster and detail subjects. This project achieves this results by way of applying a proprietary Named Entity Recognition (NER) algorithm followed by a clustering algorithm. The IE Cloud also allows any person to use this tool without having too many computational resources available to themselves.

The package outputs four types of files:

  • Wordcloud: It's an image file containing a wordcloud describing the most frequent subjects on the text. The colours represent the groups of similar subjects.

  • Wordtree: It's an html file which contains the graphic relationship between the subjects and the examples of uses in sentences. It's an interactive graphic where the user can navigate along the tree.

  • Hierarchy: It's a json file which contains the hierarchical relationship between subjects.

  • Table: It's a csv file containing the following columns:

      Message                   |  Entities                                                                                    | Groups     | Structured Message
      sobre cobranca inexistente|[{'value': 'cobrança', 'lowercase_value': 'cobrança', 'postags': 'SUBS', 'type': 'financial'}]|['cobrança']|sobre cobrança inexistente
    

Parameters

The following parameters need to be set by the user on the command line:

  • embedding_path: path to the embedding model, the file should end with .kv;
  • postagging_model_path: path to the postagging model, the file should end with .pkl;
  • postagging_label_path: path to the postagging label file, the file should end with .pkl;
  • ner_model_path: path to the ner model, the file should end with .pkl;
  • ner_label_path: path to the ner label file, the file should end with .pkl;
  • file: path to the csv file the user wants to analyze;
  • user_email: user's Take Blip email where they want to receive the analysis;
  • bot_name: bot ID.

The following parameters have default settings, but can be customized by the user;

  • node_messages_examples: it is an int representing the number of examples outputed for each subject on the Wordtree file. The default value is 100;
  • similarity_threshold: it is a float representing the similarity threshold between the subject groups. The default value is 0.65, we recommend that this parameter not be modified;
  • percentage_threshold: it is a float representing the frequency percentile of subject from which they are not removed from the analysis. The default value is 0.9;
  • batch_size: it is an int representing the batch size. The default value is 50;
  • chunk_size: it is an int representing chunk file size for upload in storaged. The default value is 1024;
  • separator: it is a str for the csv file delimiter character. The default value is '|'.

Example of initialization e usage:

  1. Import main packages;
  2. Initialize main variables;
  3. Initialize eventhub logger;
  4. Initialize Insight Extractor;
  5. Insight Extractor usage.

An example of the above steps could be found in the python code below:

  1. Import main packages
import uuid
from TakeBlipInsightExtractor.insight_extractor import InsightExtractor
from TakeBlipInsightExtractor.outputs.eventhub_log_sender import EventHubLogSender
  1. Initialize main variables
embedding_path = '*.kv'
postag_model_path = '*.pkl'
postag_label_path = '*.pkl'
ner_model_path = '*.pkl'
ner_label_path = '*.pkl'

user_email = 'your_email@host.com'
bot_name = 'my_bot_for_insight_extractor'
application_name = 'your application'

eventhub_name = '*'
eventhub_connection_string = '*'

file_name = '*'
input_data = '*.csv'
separator = '|'

similarity_threshold = 0.65
node_messages_examples = 100
batch_size = 1024
percentage_threshold = 0.7
  1. Initialize eventhub logger
correlation_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, user_email + bot_name))
logger = EventHubLogSender(application_name=application_name,
                           user_email=user_email,
                           bot_name=bot_name,
                           file_name=file_name,
                           correlation_id=correlation_id,
                           connection_string=eventhub_connection_string,
                           eventhub_name=eventhub_name)
  1. Initialize Insight Extractor
insight_extractor = InsightExtractor(input_data,
                                     separator=separator,
                                     similarity_threshold=similarity_threshold,
                                     embedding_path=embedding_path,
                                     postagging_model_path=postag_model_path,
                                     postagging_label_path=postag_label_path,
                                     ner_model_path=ner_model_path,
                                     ner_label_path=ner_label_path,
                                     user_email=user_email,
                                     bot_name=bot_name,
                                     logger=logger)
  1. Insight Extractor usage
insight_extractor.predict(percentage_threshold=percentage_threshold,
                          node_messages_examples=node_messages_examples,
                          batch_size=batch_size)

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

TakeBlipInsightExtractor-0.0.1.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TakeBlipInsightExtractor-0.0.1-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file TakeBlipInsightExtractor-0.0.1.tar.gz.

File metadata

  • Download URL: TakeBlipInsightExtractor-0.0.1.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for TakeBlipInsightExtractor-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a349da55830059f72f522577cb76431a23c93ab39eefab8370d9996e2fca2895
MD5 2c5f7f32fb6f69fd4db539e03e1e0c9a
BLAKE2b-256 085f73077dd517f61d009b74ed3a3864734a0cb50d9cc0fdcaac72a2193dc44e

See more details on using hashes here.

File details

Details for the file TakeBlipInsightExtractor-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: TakeBlipInsightExtractor-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for TakeBlipInsightExtractor-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fde15187a0bf546336920865269ffafac39c6d3e0a86da1b6c28d43f223b9c65
MD5 13598829972c7c4bca618e24d70b3345
BLAKE2b-256 2b8d1d76b4e19c55e75496226ec536b489e346317b8445159b6f97531851edae

See more details on using hashes here.

Supported by

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