{"id":25420038,"url":"https://github.com/asrot0/spacy_ner","last_synced_at":"2026-04-18T10:38:26.463Z","repository":{"id":277691925,"uuid":"933215936","full_name":"asRot0/SpaCy_NER","owner":"asRot0","description":"SpaCy-based NER🧠 implementation for extracting and classifying entities from text✨","archived":false,"fork":false,"pushed_at":"2025-02-15T13:14:57.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T19:07:44.483Z","etag":null,"topics":["machine-learning","ner","nlp","spacy","textclassification"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asRot0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-02-15T12:40:49.000Z","updated_at":"2025-02-15T13:23:22.000Z","dependencies_parsed_at":"2025-02-15T13:34:49.248Z","dependency_job_id":"7aedc851-59a6-443c-849f-b0990ab2f95b","html_url":"https://github.com/asRot0/SpaCy_NER","commit_stats":null,"previous_names":["asrot0/spacy_ner"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asRot0%2FSpaCy_NER","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asRot0%2FSpaCy_NER/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asRot0%2FSpaCy_NER/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asRot0%2FSpaCy_NER/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asRot0","download_url":"https://codeload.github.com/asRot0/SpaCy_NER/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253805861,"owners_count":21967053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["machine-learning","ner","nlp","spacy","textclassification"],"created_at":"2025-02-16T19:22:41.122Z","updated_at":"2026-04-18T10:38:26.430Z","avatar_url":"https://github.com/asRot0.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Named Entity Recognition (NER) with spaCy\n\nThis project performs **Named Entity Recognition (NER)** using **spaCy**, web scrapes text from Wikipedia, and visualizes extracted entities using **displaCy**, Matplotlib, and Rich tables.\n\n---\n\n## 📌 Features\n- 🔹 **NER on Sample Text** using `en_core_web_sm`\n- 🔹 **Web Scraping Wikipedia** for real-world text\n- 🔹 **Organizing Extracted Entities** into a dictionary\n- 🔹 **Visualizing Entity Frequencies** with Matplotlib\n- 🔹 **Beautiful Rich Table Output** for structured display\n- 🔹 **Entity Rendering with displaCy** (see below)\n\n---\n\n## 📥 Installation\n```bash\npip install spacy beautifulsoup4 requests matplotlib rich\npython -m spacy download en_core_web_sm\n```\n\n## 📝 Code Overview\n\n### 1️⃣ Load Pre-trained Model \u0026 Run NER\n```bash\nimport spacy\nNER = spacy.load(\"en_core_web_sm\")\n\ntext = \"Apple is looking at buying a U.K. startup for $1 billion.\"\ndoc = NER(text)\n\nfor ent in doc.ents:\n    print(f\"{ent.text} -\u003e {ent.label_}\")\n```\n\n### 2️⃣ Web Scrape a Wikipedia Article\n```bash\nimport requests\nfrom bs4 import BeautifulSoup\n\nurl = 'https://en.wikipedia.org/wiki/Wikipedia'\nresponse = requests.get(url)\nsoup = BeautifulSoup(response.text, \"html.parser\")\n\narticle_text = \" \".join([p.text for p in soup.find_all(\"p\")])\n```\n\n### 3️⃣ Perform NER on Scraped Text\n```bash\ndoc = NER(article_text)\n```\n\n### 4️⃣ Visualize Named Entities with displaCy\n```bash\nfrom spacy import displacy\ndisplacy.render(doc, style='ent', jupyter=True)\n```\n\n### 5️⃣ Entity Frequency Visualization\n```bash\nimport matplotlib.pyplot as plt\n\nentity_counts = {key: len(set(value)) for key, value in entity_dict.items()}\nplt.figure(figsize=(10, 5))\nplt.bar(entity_counts.keys(), entity_counts.values(), color='cornflowerblue')\nplt.xlabel(\"Entity Type\", fontsize=12, fontweight='bold')\nplt.ylabel(\"Count\", fontsize=12, fontweight='bold')\nplt.title(\"NER Distribution\", fontsize=14, fontweight='bold')\nplt.xticks(rotation=45)\nplt.grid(axis='y', linestyle='--', alpha=0.7)\nplt.show()\n```\n\n### 6️⃣ Rich Table Output\n```bash\nfrom rich.console import Console\nfrom rich.table import Table\n\nconsole = Console()\ntable = Table(title=\"🔵 Named Entity Recognition Results\", title_style=\"bold cyan\")\ntable.add_column(\"🔹 Entity Type\", style=\"bold deep_sky_blue3\", justify=\"center\")\ntable.add_column(\"🔸 Entities\", style=\"bold light_slate_grey\", justify=\"left\")\n\nfor entity_type, values in entity_dict.items():\n    table.add_row(f\"[bold bright_white]{entity_type}[/bold bright_white]\", f\"[italic dark_sea_green3]{', '.join(set(values))}[/italic dark_sea_green3]\")\n\nconsole.print(table)\n```\n\n### 🎨 displaCy Visualization Example\n\ndisplaCy is a built-in visualization tool in spaCy that renders named entities in a user-friendly format.\n\n`Apple` **ORG** is looking at buying a `U.K.` **GPE** startup for `$1 billion` **MONEY**.\n\n#### 🔗 Try it in Jupyter Notebook with:\n```bash\ndisplacy.render(doc, style='ent', jupyter=True)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasrot0%2Fspacy_ner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasrot0%2Fspacy_ner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasrot0%2Fspacy_ner/lists"}