{"id":15103581,"url":"https://github.com/kivanc57/nlp_data_visualization","last_synced_at":"2026-02-26T18:38:56.535Z","repository":{"id":251121103,"uuid":"836448292","full_name":"kivanc57/nlp_data_visualization","owner":"kivanc57","description":"This project provides Python scripts for analyzing and visualizing text data using efficient NLP methods. It includes tools for creating bar plots, histograms, pie charts, treemaps, violin plots, and word clouds, using libraries such as matplotlib, seaborn, wordcloud, spacy, and textblob.","archived":false,"fork":false,"pushed_at":"2025-08-13T13:53:52.000Z","size":2218,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-13T14:44:28.111Z","etag":null,"topics":["data-science","matplotlib","nlp","parsing","plotting","python","spacy","visualization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kivanc57.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-31T21:51:55.000Z","updated_at":"2025-08-13T13:53:55.000Z","dependencies_parsed_at":"2025-01-26T18:20:54.051Z","dependency_job_id":"9fb9be27-5ee7-487b-93a8-660fb7c66964","html_url":"https://github.com/kivanc57/nlp_data_visualization","commit_stats":{"total_commits":42,"total_committers":2,"mean_commits":21.0,"dds":"0.11904761904761907","last_synced_commit":"7a309e9300f1e1a8e45afb6a6e477b7903a46565"},"previous_names":["kivanc57/nlp_data_visualization"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kivanc57/nlp_data_visualization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kivanc57%2Fnlp_data_visualization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kivanc57%2Fnlp_data_visualization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kivanc57%2Fnlp_data_visualization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kivanc57%2Fnlp_data_visualization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kivanc57","download_url":"https://codeload.github.com/kivanc57/nlp_data_visualization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kivanc57%2Fnlp_data_visualization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29867575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T18:27:06.972Z","status":"ssl_error","status_checked_at":"2026-02-26T18:26:57.848Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","matplotlib","nlp","parsing","plotting","python","spacy","visualization"],"created_at":"2024-09-25T19:40:36.639Z","updated_at":"2026-02-26T18:38:56.510Z","avatar_url":"https://github.com/kivanc57.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NLP Data Visualization \n\n## Overview 🌈 \n\nWelcome to the **NLP Data Visualization** project! This repository contains a collection of Python scripts designed to help you analyze and visualize text data in various ways. Each script focuses on a specific type of analysis or visualization, providing a comprehensive toolkit for text data exploration.\n\nThis project utilizes a range of powerful Python libraries such as matplotlib, seaborn, wordcloud, spacy, and textblob to perform tasks like frequency analysis, sentiment analysis, and parts of speech tagging. The resulting visualizations, including bar plots, histograms, pie charts, treemaps, violin plots, and word clouds, offer clear and insightful representations of the underlying data.\n\n\nThis project includes:\n* 🌍 **Well-known Data Science libraries** 🌍\n  * Some them are: `matplotlib`, `seaborn`, `wordcloud`, `spacy`, `textblob`\n\n* 💐 **Colorful visualizations** 💐\n  * Each graph is crafted by inspiration from its own document and its function is left open to configure freely. The graphs are: `bar plots`, `histograms`, `pie charts`, `treemaps`, `violin plots`, `word clouds`\n\n* ✨ **Creative file handlings (writings+readings), tailored for large datasets** ✨\n  * These are: `txt`, `xml`, `json`, `xlsx`, `csv`, `sgm`\n\n* 🍄 *Each* scripts is a combination from one of these bulletpoints!\n\n## Table of Contents\n1. [Introduction](#introduction)\n2. [Features](#features)\n3. [Project Structure](#project_structure)\n4. [Visualizations](#visualizations)\n  * [Bar Plot](#bar_plot)\n  * [Histrogram](#histogram)\n  * [Pie Chart](#pie_chart)\n  * [Treemap](#treemap)\n  * [Violin Plot](#violin_plot)\n  * [Word Cloud](#word_cloud)\n5. [Data Analysis](#data_analysis)\n6. [Usage](#usage)\n7. [License](#license)\n8. [Contact](#contact)\n\n## 1. Introduction \u003ca id=\"introduction\"\u003e\u003c/a\u003e\n\nThis repository contains Python scripts designed for text data analysis and visualization. Each script focuses on a specific type of analysis or visualization, allowing users to gain insights into text data through various methods.\n\n## 2. Features \u003ca id=\"features\"\u003e\u003c/a\u003e\n🧬 **Comprehensive Text Analysis** 🧬 -\u003e Perform sentiment analysis, frequency analysis, and more.\n\n🔮 **Diverse Visualizations** 🔮 -\u003e Generate bar plots, histograms, pie charts, treemaps, violin plots, and word clouds.\n\n 🌋 **Library Utilization** 🌋 -\u003e Utilizes powerful Python libraries such as matplotlib, seaborn, wordcloud, spacy, and textblob.\n\n🧮 **Easy to Use** 🧮 -\u003e Scripts are designed to be easily run from the command line.\n\n⛓ **Configurable** ⛓ -\u003e Input and output paths can be easily configured for different datasets.\n\n☎️ **Logging** ☎️ -\u003e Each script includes logging to track the execution process and capture errors.\n\n\n## 3. Project Structure \u003ca id=\"project_structure\"\u003e\u003c/a\u003e\n\n```markdown\n📁 project-root\n├── 📁 config\n│ ├── 📄 __init__.py\n│ ├── 📄 common_config.py\n│ └── 📄 constants.py\n│\n├── 📁 scripts\n│ ├── 📄 __init__.py\n│ ├── 📄 entity_treemap.py\n│ ├── 📄 freq_barplot.py\n│ ├── 📄 len_histogram.py\n│ ├── 📄 len_violin.py\n│ ├── 📄 pos_cloud.py\n│ └── 📄 sentiment_piechart.py\n│\n├── 📁 (logs)\n│    ...\n│\n├── 📄 .gitignore\n└── 📄 main.py\n```\n\n**config/**: Contains configuration files.\n\n* ***\\_init_.py***: Imports configuration and utility functions.\n* ***common_config.py***: Contains common configuration functions and logging setup.\n* ***constants.py***: Defines constants used throughout the application.\n\n**src/**: Contains source code files for the project.\n* ***\\_init_.py***: Initializes the source package and imports functions from individual modules.\n\n| Script | Description | Input File | Ouput File | Graph |\n| ----------- | -------|---- |-------|--------------|\n| freq_barplot.py |  Generates frequency bar plots from XML data.| xml | txt | Bar Plot |\n| len_histogram.py | Creates histograms of sentence lengths from text files. | txt | - | Histogram |\n| sentiment_piechart.py | Generates pie charts based on sentiment analysis from text data. | sgm | - | Pie Chart |\n| entity_treemap.py | Categorizes entities and build treemaps from XML data using them. | xml | json | Tree Map |\n| len_violin_plot.py | Visualizes the length of email addresses using violin plots. | txt | xlsx | Violin Plot |\n| pos_cloud.py | Generates word clouds based on parts of speech from text data. | sgm | csv | Word Cloud |\n\n---\n\n**logs**: Stores log files after every execution. If removed or not present, its created again after execution.\n\n**.gitattributes**: Ensures consistent line endings across different operating systems in the repository.\n\n**.gitignore**: Specifies files and directories to be ignored by Git (e.g., virtual environments, build artifacts).\n\n**main.py**: In our case, giving the complexity of tasks, input and outputs of each task, this file is left *empty*. Please consult each script separately.\n\n## 4. Visualizations \u003ca id=\"visualizations\"\u003e\u003c/a\u003e\n\n### Bar Plot \u003ca id=\"bar_plot\"\u003e\u003c/a\u003e\nThe bar plot visualizes the frequency of specific entities or attributes. The script `freq_barplot.py` is used to create a bar plot of the most frequent parts of speech (verbs, subjects, and objects).\n\n![Bar Plot](/screenshots/bar_plot.png?raw=true)\n```python\ndef get_bar_plot(destination, frequency_dict, x_name, y_name, top_n=10, title=None, palette='viridis'):\n    try:\n        df = DataFrame(frequency_dict.items(), columns=[x_name, y_name])\n        df_sorted = df.sort_values(by=y_name, ascending=False).head(top_n)\n\n        plt.figure(figsize=(12, 8))\n        barplot(x=x_name, y=y_name, data=df_sorted, palette=palette, hue=x_name, legend=False)\n        plt.xlabel = x_name\n        plt.ylabel = y_name\n        if title:\n            plt.title(title, fontweight = \"bold\")\n\n        plt.savefig(destination)\n        plt.close()\n        logger.info(f\"Graph created in {destination}\")\n\n    except Exception as e:\n        logger.exception(f\"Graph failed: {e} in {destination}\")\n```\n\n### Histogram \u003ca id=\"histogram\"\u003e\u003c/a\u003e\nThe histogram displays the distribution of numerical data. The script `len_histogram.py` generates a histogram showing the distribution of sentence lengths.\n\n![Histogram](/screenshots/histogram.png?raw=true)\n\n```python\ndef get_histogram(data, destination, color = 'red', bins=20,\n                    x_label = 'Sentence Length', y_label ='Number of Sentences',\n                    graph_name='histogram.png', title=\"Distribution of Sentence Lengths\"):\n    try:\n        plt.hist(data, edgecolor='black', histtype='bar', bins=bins, color=color, alpha=0.7, density=1)\n        plt.xlabel(x_label)\n        plt.ylabel(y_label)\n        if title:\n            plt.title(\"Distribution of Sentence Lengths\", fontweight = \"bold\")\n        plt.savefig(destination)\n        plt.close()\n        logger.info(f\"Graph: {graph_name} created in {destination}\")\n\n    except Exception as e:\n        logger.exception(f\"Graph: {graph_name} failed: {e} in {destination}\")\n        return None\n```\n\n### Piechart \u003ca id=\"pie_chart\"\u003e\u003c/a\u003e\nThe pie chart shows the proportion of different categories within a dataset. The script `sentiment_pychart.py` creates a pie chart of sentiment distribution.\n\n![Piechart](/screenshots/pie_chart.png?raw=true)\n\n```python\ndef get_pie_chart(destination, sentiments_categorized, title=None, graph_name='pie_chart.png'):\n    try:\n        plt.figure(figsize=(8, 8))\n        plt.pie(\n            sentiments_categorized.values(),\n            labels=sentiments_categorized.keys(),\n            autopct='%1.1f%%',\n            colors=['#65d14f', '#66c2a5', '#c43737'],\n            explode=(0.1, 0, 0),\n            shadow=True,\n            startangle=90\n            )\n        if title:\n            plt.title(title, fontweight = \"bold\")\n        plt.savefig(destination)\n        plt.close()\n        logger.info(f\"Pie chart: {graph_name} created in {destination}\")\n    \n    except Exception as e:\n        logger.error(f\"Pie chart: {graph_name} failed: {e} in {destination}\")\n        return None\n```\n\n### Treemap \u003ca id=\"treemap\"\u003e\u003c/a\u003e\nThe treemap provides a hierarchical view of data with nested rectangles. The script `entity_treemap.py` generates a treemap visualization based on XML file content.\n\n![Treemap](/screenshots/treemap.png?raw=true)\n\n```python\ndef get_treemap(destination, entity_dict, title='Distribution of Entity Labels'):\n    try:\n        labels = list(entity_dict.keys())\n        frequencies = list(entity_dict.values())\n        squarify.plot(sizes=frequencies, label=labels, color=color_palette(\"Spectral\", len(labels)), alpha=0.7, pad=2)\n\n        if title:\n            plt.title(title, fontweight = \"bold\")\n        plt.savefig(destination)\n        plt.close()\n        logger.info(f\"Treemap created in {destination}\")\n\n    except Exception as e:\n        logger.exception(f\"Treemap failed: {e} in {destination}\")\n```\n### Violin Plot \u003ca id=\"violin_plot\"\u003e\u003c/a\u003e\nThe violin plot shows data distribution across several categories. The script `len_violin.py` generates a violin plot of email lengths.\n\n![Violin Plot](/screenshots/violin_plot.png?raw=true)\n\n```python\ndef get_violin_plot(destination, data, column_name, title=None, color='Yellow'):\n    try:\n        data_df = DataFrame(data=data, columns=[column_name])\n\n        plt.figure(figsize=(10, 6))\n        violinplot(x=column_name, data=data_df, color=color)\n        plt.xlabel(column_name)\n        if title:\n            plt.title(title, fontweight = \"bold\")\n        \n        plt.savefig(destination)\n        plt.close()\n        logger.info(f\"Graph created in {destination}\")\n\n    except Exception as e:\n        logger.exception(f\"Graph failed: {e} in {destination}\")\n```\n### Word Cloud \u003ca id=\"word_cloud\"\u003e\u003c/a\u003e\nThe word cloud visualizes the frequency of words in a text. The script `pos_cloud.py` creates a word cloud of the most frequent verbs.\n\n![Violin Plot](/screenshots/word_cloud.png?raw=true)\n\n```python\ndef get_word_cloud(destination, word_counts, title=None):\n    try:\n        wordcloud = WordCloud(\n            width=800,height=800,\n            background_color='white',\n            min_font_size=10\n            ).generate_from_frequencies(word_counts)\n        plt.figure(figsize=(12, 6))\n        plt.imshow(wordcloud, interpolation='bilinear')\n        plt.axis('off')\n        if title:\n            plt.title(title, fontweight = \"bold\")\n\n        plt.savefig(destination)\n        plt.close()\n        logger.info(f\"Graph created in {destination}\")\n\n    except Exception as e:\n        logger.exception(f\"Failed graph: {e} in {destination}\")\n```\n\n## 5. Data Analysis \u003ca id=\"data_analysis\"\u003e\u003c/a\u003e\n\nThe scripts included in this project analyze text data by performing tasks such as frequency analysis, sentiment analysis, and length distribution analysis. They generate visualizations that help in understanding the underlying patterns and characteristics of the text data.\n\n## 6. Usage \u003ca id=\"usage\"\u003e\u003c/a\u003e\n\n1. Ensure you have Python 3.x installed.\n\n2. Install the required libraries and instances when needed.\n\n3. Run the scripts by executing them from the command line:\n```bash\npython freq_barplot.py\npython len_histogram.py\npython sentiment_piechart.py\npython entity_treemap.py\npython len_violin.py\npython pos_cloud.py\n\n```\n\n## 7. License \u003ca id=\"license\"\u003e\u003c/a\u003e\n\nThis project is licensed under the GNU General Public License v3.0 (GPL-3.0) - see the [LICENSE](https://github.com/kivanc57/nlp_data_visualization/blob/main/LICENSE) file for details.\n\n## 8. Contact \u003ca id=\"contact\"\u003e\u003c/a\u003e\n\nLet me know if there are any specific details you’d like to adjust or additional sections you want to include!\n* **Email**: kivancgordu@hotmail.com\n* **Version**: 1.0.0\n* **Date**: 31-07-2024\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkivanc57%2Fnlp_data_visualization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkivanc57%2Fnlp_data_visualization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkivanc57%2Fnlp_data_visualization/lists"}