syedabdullah32 commited on
Commit
a47fc65
·
1 Parent(s): 6439d0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -1,14 +1,9 @@
1
  import streamlit as st
2
  import re
3
- import spacy
4
-
5
- # Load the spaCy English model
6
- nlp = spacy.load("en_core_web_sm")
7
 
8
  def extract_entities(text):
9
- # Using spaCy for Named Entity Recognition (NER) to extract names
10
- doc = nlp(text)
11
- names = [ent.text for ent in doc.ents if ent.label_ == "PERSON"]
12
 
13
  # Using regex to find Pakistani phone numbers
14
  phone_numbers = re.findall(r'\+\d{2,3}\d{9,12}\b', text)
 
1
  import streamlit as st
2
  import re
 
 
 
 
3
 
4
  def extract_entities(text):
5
+ # Using regex to find names
6
+ names = re.findall(r'\b[A-Z][a-z]+ [A-Z][a-z]+\b', text)
 
7
 
8
  # Using regex to find Pakistani phone numbers
9
  phone_numbers = re.findall(r'\+\d{2,3}\d{9,12}\b', text)