Я пытаюсь извлечь человеческие имена из текста.
Есть ли у кого-нибудь метод, который они бы порекомендовали?
Он также извлекает так много других данных. Почему это происходит: пытался сделать так много всего, чтобы извлечь человеческое имя из файла, но всегда с какой-то ошибкой. Потому что я хочу получить человеческое имя с каждым предложением, а затем сопоставить это имя с моим db, а затем связать это предложение с этим человеческим именем. Но добиться не удалось.
from nameparser.parser import HumanName
from nltk.corpus import wordnet
person_list = []
person_names=person_list
def get_human_names(text):
tokens = nltk.tokenize.word_tokenize(text)
pos = nltk.pos_tag(tokens)
sentt = nltk.ne_chunk(pos, binary = False)
person = []
name = ""
for subtree in sentt.subtrees(filter=lambda t: t.label() == 'PERSON'):
for leaf in subtree.leaves():
person.append(leaf[0])
if len(person) > 1: #avoid grabbing lone surnames
for part in person:
name += part + ' '
if name[:-1] not in person_list:
person_list.append(name[:-1])
name = ''
person = []
# print (person_list)
text = """
Pooja Hegde Says Instagram Was Hacked After Meme On Samantha Ruth Prabhu Were Posted <title-break> Pooja Hegde shared this image.On Monday night, Pooja tweeted that her Instagram had been hacked and was in the process of being retrieved.— Pooja Hegde (@hegdepooja) May 27, 2020Spent the last hour stressing about the safety of my Instagram account.— Pooja Hegde (@hegdepooja) May 27, 2020Pooja Hegde's feed has been cleaned up now - the most recent Instagram post is now one on pet food that she posted three days ago.Pooja Hegde works mainly in the Telugu film industry and has also appeared in Hindi movies like Mohenjo Daro and Housefull 4.
T-Series' Hanuman Chalisa Crosses 1 Billion Views On Youtube <title-break> Hariharan in a still from Hanuman Chalisa.The recitation of Hanuman Chalisa is known to ward off evil and danger and empowers one with the strength and courage to face any problem head-on.T-Series' Hanuman Chalisa, sung by veteran singer Hariharan, which prominently features T-Series founder Gulshan Kumar, becomes the go-to rendition of this holy recital, crossing the highly coveted 1 billion mark on YouTube.Says T-Series head Bhushan Kumar, "People turn to and recite the Hanuman Chalisa during their low phase.We, at T-Series have always focused, supported and brought to audiences devotional music right from the time of the inception of the company."
Henry Cavill May Return As Superman And Twitter Is Losing Its Mind <title-break> Henry Cavill in Batman v Superman.While we await the official confirmation, Twitter is busy rejoicing over the reports and can't wait to see Henry Cavill in the Superman cape once again.Henry Cavill made his first appearance as Superman in 2013's Man Of Steel.Before Henry Cavill, the Superman cape has been worn by actors such as Christopher Reeve, Brandon Routh and Tom Welling.DC Universe's films aside, Henry Cavill famously starred in Mission: Impossible - Fallout alongside franchise veteran Tom Cruise.
Pooja Batra's Throwback Pic Of Nawab Shah Proposing To Her Is Pure Gold <title-break> On Thursday, the 43-year-old actress shared a set of pictures with Nawab Shah and it has our heart.In the pictures, Nawab can be seen kneeling in front of Pooja and holding her hand, while Pooja can be seen smiling with all her heart.Take a look:Pooja and Nawab Shah never fail to paint Instagram red with their loved-up posts for each other."Nawab Shah and I are following the government guidelines to minimise the spread and impact of COVID-19 and encourage all to stay home.On the other hand, Nawab Shah has starred in films such as Don 2, Tiger Zinda Hai, Panipat, Luck and Dilwale.
Shraddha Kapoor And Brother Siddhanth Found A New "Adventure" To Go On <title-break> (courtesy: shraddhakapoor)Highlights Shraddha and Siddhanth shared identical photos on Instagram"Make sure you are wearing a mask," wrote Siddhanth"Stay safe and all," he addedShraddha Kapoor and her brother Siddhanth found a fun way to spend quality time together.Sharing a picture on her Instagram profile on Thursday, Shraddha described it as "groceries adventure with my bhaiya Siddhanth Kapoor."Siddhanth Kapoor, in his caption, wrote: "It's a lot of fun when you go grocery shopping with your sibling."What fun yaar.... Should do this every day (kidding)," Siddhanth Kapoor commented on his sister's post.Siddhanth Kapoor has starred in films like Shootout at Wadala, Jazbaa, Ugly, Bombairiya and Paltan among others.
Reese Witherspoon And Son Are "Dreaming" Of Travelling To India <title-break> Reese Witherspoon shared this image.On Thursday, Reese shared a picture on her Instagram profile where the mother-son duo can be seen engrossed in reading an activity book on India.In the picture, Tennessee can be seen holding a pen while Reese can be seen pointing to a page with 'India' written on it.Sharing the picture, Reese wrote, "Dreaming of the places we will go."Reese Witherspoon has a body of work that includes films such as Election, Cruel Intentions, Legally Blonde, Sweet Home Alabama, Walk The Line and Wild.
Amitabh Bachchan, As He Once Was Vs As He Is Now. See His Post <title-break> In a then vs now mood, Amitabh Bachchan shared a picture collage of himself from his 1976 film Kabhie Kabhie, and a snippet of his look from his upcoming film Gulabo Sitabo.Sharing the picture, Big B wrote about the evergreen song Kabhi Kabhi Mere Dil Mein from Kabhie Kabhie."Srinagar, Kashmir.. Kabhie Kabhie.. writing the verse for the song Kabhi Kabhi Mere Dil Mein Khayaal Aata Hai," he wrote.Sahir Ludhianvi received the Filmfare Award for the best lyricist for Kabhi Kabhi Mere Dil Mein.Kabhie Kabhie also starred Rishi Kapoor and Neetu Kapoor in pivotal roles.
When Varun Dhawan And Kiara Advani Danced To Sun Saathiya <title-break> (courtesy: YouTube)Highlights Varun posted a video on his YouTube accountThe song originally featured Varun and Shraddha Kapoor"I hope you guys like this video," wrote Varun DhawanYou might have seen Varun Dhawan and Kiara Advani dancing together to the song First Class from the 2019 period drama Kalank but have you seen them grooving together to ABCD 2's Sun Saathiya?On Wednesday, Varun posted a video from his and Kiara's dance rehearsal session on his official YouTube channel.Here's a throwback dance cover video of my rehearsal with Kiara Advani.Kiara Advani was last seen in Netflix's Guilty.Kiara Advani made her Bollywood debut with the 2014 film Fugly.
Gabriella Demetriades Is "Back To The City." See Her Post <title-break> Gabriella Demetriades shared this photo.In the pictures, Gabriella can be seen sporting an all-white outfit while clicking mirror selfies in her apartment.Sharing the pictures, Gabriella captioned her post with these words: "Back to the city and my spot."Take a look:Earlier in the day, Gabriella Demetriades shared stunning pictures of herself chilling at the farmhouse.Gabriella Demetriades and Arjun Rampal started dating in 2018 after meeting through common friends.
Can You Spot Sonam And Arjun Kapoor In This Priceless Throwback Pic? <title-break> Aadar Jain shared this photo.On Wednesday, Aadar shared a photo from his childhood featuring Sonam Kapoor, her cousin Arjun Kapoor and others.The throwback photo was also re-shared by Sonam and Arjun Kapoor on their respective social media profile.On the other hand, Sonam Kapoor's last project remains the 2019 romance-drama The Zoya Factor.Sonam Kapoor's brother Harshvardhan Kapoor made his debut in Bollywood as a lead actor with Rakeysh Omprakash Mehra's Mirzya.
When Kriti Sanon's Sister Nupur Gave Her A Haircut At Home. So, How Did She Do? <title-break> (Image courtesy: kritisanon)Highlights Kriti Sanon posted a video from her haircut session on Instagram"The short hair looks so cute," commented a fan"Thank you, Nupur Sanon for such a refreshing cut," wrote Kriti SanonLeave it to Kriti and Nupur Sanon to set sister goals for every occasion.A few days ago, Kriti posted a video of Nupur giving her a haircut at home.Sharing the video on Instagram, Kriti wrote: "Baal baal bach gaye... Watch it till the end to see for yourself!Kriti Sanon made her Bollywood debut with the 2014 film Heropanti, co-starring Tiger Shroff.Kriti's sister Nupur Sanon is a singer, who made her acting debut opposite Akshay Kumar in B Praak's music video, titled Filhall.
Viral: Kareena Kapoor Asking "What Is The Meaning" While Filming Dabangg 2 Song Fevicol Se <title-break> Kareena Kapoor in a still from the clip.(Image courtesy: kareena.arabfc)Highlights Kareena Kapoor featured in a special dance number in 'Dabangg 2'A throwback video of hers shooting the track Fevicol Se is trending"What is the meaning of that..patrol se?"The clip is actually a BTS video of Kareena shooting the film's track Fevicol Se and it is going crazy viral on social media.The peppy track featured Kareena dancing with Salman Khan, who played the lead in all the three parts of the Dabangg series.Check out the viral clip, shared by several fan-pages dedicated to Kareena Kapoor, here:The first part of the Dabangg series featured Malaika Arora in the song Munni Badnaam Hui.
A Thoughtful Ranveer Singh, Described Best In Two Pics <title-break> Ranveer Singh shared this photo (courtesy ranveersingh)Highlights Ranveer shared two new photos on InstagramBoth the pics are close-up shots of the actorHe shared the pics without captionsRanveer Singh, who loves to interact with his fans on Instagram, updated his feed with two new photos recently.In one of the photos, Ranveer can be seen enjoying sea vibes on what appears to be a beach.The actor paid a tribute of sorts to Sylvester Stallone aka Rocky Balboa of the Rocky series of films, with this cool selfie.Ranveer Singh, who loves being extra, also posted this photo of himself as Joe Exotic of Netflix crime series Tiger King.Ranveer Singh was last seen in Gully Boy.
Amitabh Bachchan's Amar Akbar Anthony "Crosses Collections Of Baahubali 2," Allowing For Inflation <title-break> Sharing a black and white photo from the film's sets, Big B wrote: "Shweta and Abhishek visited me on sets of Amar Akbar Anthony.On Twitter, Amitabh Bachchan shared a few more Amar Akbar Anthony memories:T 3544 -43 YEARS .... 'Amar Akbar Anthony' is estimated to have made Rs 7.25 crore in those days.In March, Amitabh Bachchan shared this priceless gem from the film's mahurat with Dharmendra holding the clapperboard.pic.twitter.com/wKpMBIrubZ — Amitabh Bachchan (@SrBachchan) March 2, 2020Amitabh Bachchan will next be seen in Gulabo Sitabo, which releases on Amazon Prime on June 12.
"A Year Since You Left": Ajay Devgn Posts Tribute To Father Veeru <title-break> Ajay Devgn shared this video.(courtesy ajaydevgn)Highlights Ajay shared a video collage featuring Veeru Devgan"Your presence is reassuring," Ajay addedAbhishek Bachchan commented with a folded hands emoticonIn a moving tribute to father Veeru Devgan, Ajay Devgn shared a video collage featuring himself with Veeru Devgan on his Instagram profile.In the monochrome video collage, Ajay Devgn and Veeru Devgan can be seen posing for the camera on various occasions.Remembering Veeru Devgan on his first death anniversary, Ajay Devgn wrote a heartwarming post dedicated to him.Last year, on Teacher's day, Ajay Devgn remembered Veeru Devgan for the "invaluable life lessons."
Namrata Shirodkar's Throwback Pic Of Mahesh Babu And Son Gautham Is "Just Too Adorable" <title-break> The actress, who is rummaging through the dust-caked family albums in lockdown, just dropped another adorable throwback picture on her Instagram profile.Adding to her series "memory therapy," Namrata shared a picture featuring Mahesh Babu and their son Gautham and it is a blast from the past.In the picture, Mahesh Babu can be seen holding a pint-sized Gautham as they pose for the camera together.She wrote, "Mahesh Babu, do you even remember where this was?Take a look:Namrata Shirodkar keeps treating her Instafam to adorable throwback pictures featuring Mahesh Babu, son Gautham and daughter Sitara.
Karan Johar Thinks Rani Mukerji Is A "Magician." Here's Why <title-break> Karan Johar with Rani Mukerji.Sharing a picture of the drool-worthy cake, Karan Johar wrote a thank you note for Rani.Rani Mukerji and Karan Johar share a great rapport with each other.Karan Johar was the only Bollywood celebrity to be present at the wedding ceremony of Rani Mukerji in Italy - the actress got married to Aditya Chopra in 2014.Rani has worked with Karan Johar in films such as Kuch Kuch Hota Hai, Kabhi Khushi Kabhie Gham and Kabhi Alvida Naa Kehna.
Viral: The Internet Struck Gold With This Pic Of Shah Rukh Khan As A Teen <title-break> Shah Rukh Khan, who began his career as an actor with Fauji in 1988, attended St. Columba's School in New Delhi.In the photo, Shah Rukh can be seen posing with who seem to be his classmates.After passing out from school, Shah Rukh graduated from Delhi's Hansraj college.A year before his Bollywood debut, Shah Rukh got married to Gauri Khan.Shah Rukh Khan, who was last seen in Zero, has a few production projects lined-up.
Priyanka Chopra's "Zoom Meeting Lewk" Is Pretty Much The Same As Ours <title-break> And while switching between chilling on the couch and attending work meetings via Zoom, Priyanka has discovered the art of a quick look change.The busy actress shared glimpses of her "Zoom meeting lewk" on Instagram recently and all we can say is - been there, done that.Priyanka shared two photos in which she can be seen sporting a white blazer over a peach top and a pair of white pyjamas.For accessories, Priyanka was wearing flip flops, to go with her pyjama/zoom meeting "lewk".She recently shared this "Expectation vs reality" post, which will make you roll on the floor laughing.
"
"""
names = get_human_names(text)
for person in person_list:
person_split = person.split(" ")
for name in person_split:
if wordnet.synsets(name):
if(name in person):
person_names.remove(person)
break
print(person_names)
Вывод кода
['Samantha Ruth Prabhu Were', 'Pooja Hegde', 'Mohenjo Daro', 'Gulshan Kumar', 'Bhushan Kumar', 'Twitter Is', 'Brandon Routh', 'Pooja Batra', 'Her Is Pure Gold', 'Shraddha Kapoor', 'Highlights Shraddha', 'Siddhanth Kapoor', 'Son Are', 'Legally Blonde', 'Amitabh Bachchan', 'Kabhie Kabhie', 'Kabhi Kabhi Mere Dil Mein', 'Kabhi Kabhi Mere Dil', 'Rishi Kapoor', 'Neetu Kapoor', 'Varun Dhawan', 'Highlights Varun', 'Varun DhawanYou', 'Kiara Advani', 'Gabriella Demetriades', 'Arjun Rampal', 'Arjun Kapoor', 'Sonam Kapoor', 'Harshvardhan Kapoor', 'Rakeysh Omprakash Mehra', 'Sister Nupur Gave', 'Nupur Sanon', 'Akshay Kumar', 'Kareena Kapoor', 'Fevicol Se', 'Malaika Arora', 'Munni Badnaam Hui', 'Ranveer Singh', 'Sylvester Stallone', 'Joe Exotic', 'Amar Akbar Anthony', 'Amazon Prime', 'Father Veeru', 'Veeru Devgan', 'Ajay Devgn', 'Namrata Shirodkar', 'Son Gautham', 'Karan Johar', 'Aditya Chopra', 'Kuch Kuch Hota Hai', 'Kabhi Khushi Kabhie Gham', 'Kabhi Alvida Naa Kehna', 'Shah Rukh Khan', 'Shah Rukh', 'Priyanka Chopra']