From fd590b3a2288189a649be2bffa0b2045514d45a9 Mon Sep 17 00:00:00 2001 From: Patryk Bartkowiak Date: Sun, 12 May 2024 23:12:15 +0200 Subject: [PATCH] 2024-05-12 lab 9, 10 --- lab/lab_09-10.ipynb | 437 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 387 insertions(+), 50 deletions(-) diff --git a/lab/lab_09-10.ipynb b/lab/lab_09-10.ipynb index 683cdfa..eaa13fb 100644 --- a/lab/lab_09-10.ipynb +++ b/lab/lab_09-10.ipynb @@ -42,7 +42,18 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 19, + "id": "cf32e9e7", + "metadata": {}, + "outputs": [], + "source": [ + "import warnings\n", + "warnings.filterwarnings('ignore')" + ] + }, + { + "cell_type": "code", + "execution_count": 20, "id": "revolutionary-trust", "metadata": {}, "outputs": [ @@ -50,37 +61,36 @@ "name": "stdout", "output_type": "stream", "text": [ - "Nastolatek ukradł znajomemu 4500 złotych. Wcześniej pił z nim alkohol\n", - "Czekają nas kolejne podwyżki rachunków. Tym razem za ogrzewanie i ciepłą wodę\n", - "Nie żyje Piotr Ś. Czyściciel kamienic miał 47 lat\n", - "Maciej Skorża nie zmienił zdania o systemie na mecz z Rakowem. Kolejorz ma szybką okazję do rehabilitacji\n", - "Kto zabił Kazimierę Kurkowiak? Poznańskie Archiwum X wraca do sprawy sprzed 30 lat\n", - "Mieszkańcy osiedla Kwiatowego zyskają nowy chodnik\n", - "Poznańskie ZOO ponownie się otwiera i apeluje o kupowanie biletów online\n", - "1700 zł mandatu dla motocyklisty: nie ma prawa jazdy, jechał za szybko\n", - "Plac Wolności ma tętnić życiem. Jest koncepcja zagospodarowania\n", - "Dzikie wysypisko w Wielkopolskim Parku Narodowym, a w nim paczka z telefonem odbiorcy\n", - "Dobre wieści z Łazarza! \"Zielona Perła\" sprzedana!\n", - "Sokoły wędrowne w gnieździe na kominie poznańskiej elektrociepłowni! Są 4 młode\n", - "720 nowych zakażeń w Wielkopolsce\n", - "Uderzył kobietę w sklepie: \"sprawca będzie rozliczony\"\n", - "Zespół Szkół Geodezyjno- Drogowych. Przyszłość rysuje się w kolorowych barwach!\n", - "Tajemniczy wypadek i pożar pod Kwilczem. Auto spłonęło, w środku nikogo nie było\n", - "Nad Jeziorem Maltańskim powstanie duży hotel? \"Ma uzupełniać infrastrukturę sportową\"\n", - "Śmiertelny wypadek na trasie S8: samochód potrącił rowerzystę\n", - "Specjaliści o poszukiwaniu Natalii Lick: \"niestety trop psa prowadził na Wartostradę\"\n", - "Korki przy skrzyżowaniu Grochowska / Grunwaldzka: ruszyły prace!\n", - "Restauracja w Kaliszu przyjmuje klientów: sanepid i policja \"odwiedzili\" lokal\n", - "Ile kosztuje wywóz odpadów?\n", - "Dachowanie auta na trasie Konin - Turek\n", - "Kierowca BMW pod wpływem narkotyków, pasażer w ich posiadaniu. Obaj zostali zatrzymani\n", - "Leszno: mężczyzna uderzył klientkę sklepu. Poszło o maseczkę?\n", - "Od poniedziałku zapłacimy za parkowanie na kolejnych ulicach\n", - "Włamał się do obiektu handlowego. Grozi mu nawet 15 lat więzienia\n", - "Rondo Śródka: kolizja z udziałem dwóch pojazdów\n", - "Europoseł PSL: oświadczenie Episkopatu ma wpływ na proces szczepień. \"Bardzo dużo ludzi zrezygnowało\"\n", - "Bezcenna wygrana Enea Energetyka. Poznanianki zagrają w fazie play-off\n", - "No to w drogę! Po odmienionych trasach w Wielkopolsce\n" + "Wypadek na Dąbrowskiego. Jedno z aut dachowało\n", + "Znów gęsty dym nad miastem\n", + "IMGW ostrzega. W 19 powiatach naszego regionu!\n", + "Kolejna inwestycja zakończona. Na samym Starym Rynku\n", + "Lech przegrał z Legią w Poznaniu. Dwa gole samobójcze\n", + "W każdym elektrycznym Volkswagenie ID znajdziemy \"kawałek Poznania\"\n", + "Takie parkomaty stawiają na poznańskich ulicach. Będzie dużo nowości. Za parkowanie zapłacimy kartą i blikiem\n", + "Policjanci publikują wizerunek i szukają jednego z klientów poznańskiego pubu\n", + "Zielone naklejki na lampach w poznańskich parkach. Co oznaczają?\n", + "Nowy sposób oszustów. Mogą pisać takie wiadomości\n", + "Szukamy Ciebie! Najlepsze oferty pracy dla osób z niepełnosprawnościami\n", + "Park przemysłowy pod Poznaniem sprzedany za 92,5 mln euro\n", + "Warta zagrała w Krakowie\n", + "\"Biały dym\" nad miastem. Po przejeździe pociągu z kibicami Legii Warszawa?\n", + "Czytelnik zwraca uwagę na kolejne niebezpieczne skrzyżowanie w Poznaniu. \"W tym miejscu nie ma znaku\"\n", + "Jeżdżą i robią ważne badania w Wielkopolsce. W maju zaplanowanych jest jeszcze 135 postojów\n", + "Pierożki Dim Sum z Para Bar Rataje ze specjalną zniżką!\n", + "Ogromna strata zakochanej kobiety. Marynarz już miał wysłać do niej walizkę\n", + "Dziś mecz podwyższonego ryzyka. Czekają nas spore utrudnienia w okolicach stadionu!\n", + "Miejsce z Poznania może zostać Cudem Polski 2024. Trwa głosowanie\n", + "Kolejna inwestycja na Starołęce. Ruszyła budowa\n", + "Część poznaniaków nie musi dziś płacić za bilet! Dla kogo darmowa komunikacja?\n", + "Nie wszyscy mieszkańcy poznańskich osiedli mogą iść dziś na wybory\n", + "Portowo - tu życie płynie\n", + "Zaginął 42-latek. \"Przed północą oddalił się w nieznanym kierunku\"\n", + "Ostatniej nocy na niebie znów rozegrał się niezwykły spektakl\n", + "Policjanci z Wildy publikują wizerunek i szukają tego mężczyzny\n", + "Czterdzieści kotów w jednym domu. Nie wszystkie żyły\n", + "ZDM nie łata dziur w jezdniach? \"Od 2 miesięcy zgłaszam i zero reakcji\"\n", + "Kino plenerowe dziś na Łazarzu. \"Za free!\"\n" ] } ], @@ -108,13 +118,90 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 21, "id": "moving-clothing", "metadata": {}, "outputs": [], "source": [ "def get_names(article_type):\n", - " return []" + " url = f\"https://m.ceneo.pl/;szukaj-{article_type}\"\n", + "\n", + " page = requests.get(url)\n", + " soup = BeautifulSoup(page.content, 'html.parser')\n", + "\n", + " prod_names = soup.find_all('div', {'class':'list-prod-name'})\n", + " prod_names = [prod_name.get_text().strip() for prod_name in prod_names]\n", + "\n", + " return prod_names" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "906c69bc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Telewizor LED TCL 43P638 43 cale 4K UHD',\n", + " 'Telewizor LED LG 32LQ630B6LA 32 cale HD Ready',\n", + " 'Telewizor LED Xiaomi Mi LED TV P1 43 cale 4K UHD']" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_names('telewizor')[-3:]" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "e59d26d6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Pralka Electrolux PerfectCare 600 EW6SM404WP',\n", + " 'Pralka MPM MPM-4610-PH-03',\n", + " 'Pralka Whirlpool FFS 7259 B EE']" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_names('pralka')[-3:]" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "904a7b8b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Laptop Acer Nitro 16 AN16-41 R7-7840HS/16GB/1TB/RTX4070/W11 165Hz',\n", + " 'Laptop Lenovo IdeaPad Slim 3 15ABR8 15,6\"/Ryzen5/16GB/512GB/NoOS (82XM009NPB)',\n", + " 'Laptop Dell Latitude 7640 16\"/i7/32GB/1TB/Win11 (N010L764016EMEA_VP)']" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_names('laptop')[-3:]" ] }, { @@ -135,13 +222,96 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "german-dispute", "metadata": {}, "outputs": [], "source": [ - "def scrape_names():\n", - " return []" + "def scrape_names(article_type: str, num_pages: int):\n", + " url = f\"https://m.ceneo.pl/;szukaj-{article_type}\"\n", + " page = requests.get(url)\n", + "\n", + " prod_names = []\n", + " for page_idx in range(1, num_pages+1):\n", + " tmp_page = requests.get(f\"{page.url};0020-30-0-0-{page_idx}.htm\")\n", + " soup = BeautifulSoup(tmp_page.content, 'html.parser')\n", + "\n", + " tmp_prod_names = soup.find_all('div', {'class':'list-prod-name'})\n", + " tmp_prod_names = [prod_name.find('span') for prod_name in tmp_prod_names]\n", + " tmp_prod_names = [prod_name.get_text().strip() for prod_name in tmp_prod_names]\n", + "\n", + " prod_names.extend(tmp_prod_names)\n", + "\n", + " return prod_names" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "6a5297e5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Telewizor LED LG 70UR80003LJ 70 cali 4K UHD',\n", + " 'Telewizor QLED Samsung QE85Q70C 85 cali 4K UHD',\n", + " 'Telewizor LED Hisense 32A4K 32 cale 4K UHD']" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scrape_names('telewizor', 3)[-3:]" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "d2203b11", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Pralka Bosch Serie 4 WGG0440EPL',\n", + " 'Pralka Haier I-Pro 3 HW90-BP14939',\n", + " 'Pralka Samsung WW11BGA046AE']" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scrape_names('pralka', 3)[-3:]" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "a600a91b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['Laptop Dell Latitude 3340 13,3\"/i3/8GB/256GB/Win11 (L1333400023853SA)',\n", + " 'Laptop HP ZBook Firefly 14 G8 14\"/i7/16GB/512GB/Win10 (2C9R0EA)',\n", + " 'Laptop HP 17-CN3053 17,3\"/i5/32GB/2TB/Win11 (7F8G5UA)']" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scrape_names('laptop', 3)[-3:]" ] }, { @@ -154,7 +324,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 29, "id": "premium-button", "metadata": {}, "outputs": [ @@ -162,7 +332,7 @@ "name": "stdout", "output_type": "stream", "text": [ - " Yahoo Make Yahoo Your HomepageDiscover something new every day from News, Sports, Finance, Entertainment and more! HOME MAIL NEWS FINANCE SPORTS ENTERTAINMENT LIFE SHOPPING YAHOO PLUS MORE... Download the Yahoo Home app Yahoo Home Search query Sign in Mail Sign in to view your mail Mail Mail COVID-19 COVID-19 News News Finance Finance Sports Sports Entertainment Entertainment Life Life Shopping Shopping Yahoo Plus Yahoo Plus More... More... Follow live:Closing arguments begin for Derek Chauvin's murder trial in the death of George Floyd 5 people in hospital after shooting in Louisiana One victim was shot in the head, and another suffered multiple gunshot wounds, according to local news outlet.Multiple police units dispatched to scene »2 dead in crash of Tesla with 'no one' drivingMall shooter, 16, faces 1st-degree murder charge'80s pop star rips 'Simpsons' for 'hateful' parodyConspiracy theorist Alex Jones faces a reckoningPig's head left at former home of Chauvin trial witness U.S.HuffPostFirst-Ever Wild Wolf Collar Camera Shows What They Really Do All Day LongThis canine's favorite meal might surprise you. Thanks for your feedback! CelebrityThe TelegraphRobert De Niro unable to turn down acting roles because of his ‘estranged wife's expensive lifestyle’Hollywood legend Robert De Niro is unable to turn down acting roles because he must pay for his estranged wife's expensive tastes, the actor's lawyer has claimed. Caroline Krauss told a Manhattan court that he is struggling financially because of the pandemic, a massive tax bill and the demands of Grace Hightower, who filed for divorce in 2018 after 21 years of marriage. The court has been asked to settle how much De Niro should pay Ms Hightower, 66, until the terms of the prenuptial agreement the couple negotiated in 2004 takes effect. “Mr De Niro is 77 years old, and while he loves his craft, he should not be forced to work at this prodigious pace because he has to,” Ms Krauss told the court. “When does that stop? When does he get the opportunity to not take every project that comes along and not work six-day weeks, 12-hour days so he can keep pace with Ms Hightower’s thirst for Stella McCartney?” Thanks for your feedback! U.S.Associated PressCouple: Man has tossed used cups in their yard for 3 yearsAn upstate New York couple may have finally solved the mystery of who's been tossing used coffee cups in their front yard for nearly three years. Edward and Cheryl Patton told The Buffalo News they tried mounting a camera in a tree in front of their home in Lake View to catch the phantom litterer. After Edward Patton called police, they waited and pulled over a vehicle driven by 76-year-old Larry Pope, who Cheryl Patton said had once worked with her and had had disagreements with her over union issues. Thanks for your feedback! U.S.INSIDERA leading conspiracy theorist who thought COVID-19 was a hoax died from the virus after hosting illegal house partiesA high-profile conspiracy theorist from Norway, who shared false information about the pandemic online, has died from COVID-19, officials say. Thanks for your feedback! PoliticsThe WeekOne America News Network producer says 'majority' of employees didn't believe reports on voter fraud claimsMarty Golingan, a producer at One America News Network, a right-wing cable news channel often noted for its affinity for former President Donald Trump, told The New York Times he was worried his work may have helped inspire the Jan. 6 Capitol riot. At one point during the incident, Golingan said he caught sight of someone in the mob holding a flag with OAN's logo. \"I was like, OK, that's not good. That's what happens when people listen to us,\" he told the Times, referring to OAN's coverage of the 2020 presidential election, which often gave credence to Trump's unfounded claims of widespread voter fraud and Democratic conspiracies. Golingan said that many of his colleagues, including himself, disagreed with the coverage. \"The majority of people did not believe the voter fraud claims being run on the air,\" he told the Times. Indeed, the Times interviewed 18 current and former OAN employees, 16 of whom said the channel has \"broadcast reports that they considered misleading, inaccurate, or untrue.\" But Allysia Britton, a former producer and one of more than a dozen employees to leave OAN in the wake of the riot, explained that while \"many people have raised concerns ... when people speak up about anything, you will get in trouble.\" Read more at The New York Times. More stories from theweek.comThe new HBO show you won't be able to stop watchingDonald Trump's most dangerous political legacyTrump's NSA general counsel Michael Ellis resigns, never having taken office Thanks for your feedback! BusinessMoneyWiseFourth stimulus check update: Biden faces mounting pressure for new paymentAdvocates and lawmakers say the crisis isn't over, and neither is the need for relief. Thanks for your feedback! CelebrityThe TelegraphLand Rover driver at Prince Philip's funeral spent week ensuring he could drive at correct speedHuffPostPrince Philip's Funeral, In PhotosUSA TODAY EntertainmentWhy did Prince Philip's Land Rover carry his casket? The story behind the strange hearse Thanks for your feedback! Trending Now1. Gianna Hammer2. Derek Chauvin3. Black Rob4. 2021 Acm Awards5. Baby Shower Invitations6. Amanda Broderick7. Mortgage Refinance Calculator8. Interest Rates Today9. Tesla Crash10. Mars Helicopter Yahoo! Mail WeatherWeatherGreater PolandView your LocationsRemove from favorite locationsDetect my locationEnter City or ZipcodeManage LocationsToday66°45°TueRain today with a high of 59 °F (15.0 °C) and a low of 41 °F (5.0 °C). There is a 50% chance of precipitation.59°41°WedPartly cloudy today with a high of 57 °F (13.9 °C) and a low of 41 °F (5.0 °C).57°41°ThuScattered showers today with a high of 48 °F (8.9 °C) and a low of 37 °F (2.8 °C). There is a 35% chance of precipitation.48°37°See More » ScoreboardChange Sports to display different scoresNBA NFL MLB NHL NCAAB NCAAF Trending YesterdayTodayTomorrowPortland Charlotte 101109FinalSacramento Dallas 121107FinalMinnesota LA Clippers 105124FinalMore scores » HoroscopeChange your horoscope signAriesTaurusGeminiCancerLeoVirgoLibraScorpioSagittariusCapricornAquariusPiscesApril 19 -Aries - You're feeling the heat, and you may find that your friends like it as much as you do! Your great energy is perfect for almost any activity, so light up the night and have a great time! See more » Yahoo! Mail Yahoo! Sports Terms (Updated)Privacy (Updated)AdvertiseAbout Our AdsCareersHelpFeedback Close this content, you can also use the Escape key at anytime \n" + "Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos News Today's news US Politics World Tech Reviews and deals Audio Computing Gaming Health Home Phones Science TVs Climate change Health Science 2024 election Originals The 360 Life Health COVID-19 Fall allergies Health news Mental health Relax Sexual health Studies The Unwind Parenting Family health So mini ways Style and beauty It Figures Unapologetically Horoscopes Shopping Buying guides Food Travel Autos Gift ideas Buying guides Entertainment Celebrity TV Movies Music How to Watch Interviews Videos Shopping Finance My portfolio My watchlist News Stock market Economics Earnings Crypto Politics Biden economy Personal finance Markets Stocks: most active Stocks: gainers Stocks: losers Trending tickers Futures World indices US Treasury bonds Currencies Crypto Top ETFs Top mutual funds Highest open interest Highest implied volatility Currency converter Sectors Basic materials Communication services Consumer cyclical Consumer defensive Energy Financial services Healthcare Industrials Real estate Technology Utilities Screeners Watchlists Equities ETFs Futures Index Mutual funds Analyst rating screener Technical events screener Smart money screener Top holdings screener Personal finance Credit cards Balance transfer cards Cash back cards Rewards cards Travel cards Banking CD rates Online checking High-yield savings Money market Mortgage Home equity loan HELOC Personal loans Student loans Insurance Taxes Videos ETF report FA corner Options pit Crypto Industries Sports Fantasy News Fantasy football Best Ball Pro Pick 'Em College Pick 'Em Fantasy baseball Fantasy hockey Fantasy basketball Download the app Daily fantasy NFL News Scores and schedules Standings Stats Teams Players Drafts Injuries Odds Super Bowl GameChannel Videos MLB News Scores and schedules Standings Stats Teams Players Odds Videos World Baseball Classic NBA News Draft Scores and schedules Standings Stats Teams Players Injuries Videos Odds Playoffs NHL News Scores and schedules Standings Stats Teams Players Odds Playoffs Soccer News Scores and schedules Premier League MLS NWSL Liga MX CONCACAF League Champions League La Liga Serie A Bundesliga Ligue 1 World Cup College football News Scores and schedules Standings Rankings Stats Teams Show all MMA WNBA Sportsbook NCAAF Tennis Golf NASCAR NCAAB NCAAW Boxing USFL Cycling Motorsports Olympics Horse racing GameChannel Rivals Newsletters Podcasts Videos RSS Jobs Help World Cup More news New on Yahoo Games Tech Terms Privacy Privacy & Cookie Settings Feedback US English Select edition USEnglish US y LATAMEspañol AustraliaEnglish CanadaEnglish CanadaFrançais DeutschlandDeutsch FranceFrançais 香港繁中 MalaysiaEnglish New ZealandEnglish SingaporeEnglish 台灣繁中 UKEnglish © 2024 All rights reserved. About our ads Advertising Careers Yahoo Home Yahoo Home Search query Select edition USEnglish US y LATAMEspañol AustraliaEnglish CanadaEnglish CanadaFrançais DeutschlandDeutsch FranceFrançais 香港繁中 MalaysiaEnglish New ZealandEnglish SingaporeEnglish 台灣繁中 UKEnglish News Finance Sports More News Today's news US Politics World Weather Climate change Health Science 2024 election Originals Life Health Parenting Style and beauty Horoscopes Shopping Food Travel Autos Gift ideas Buying guides Entertainment Celebrity TV Movies Music How to watch Interviews Videos Shopping Finance My portfolio Watchlists Markets News Videos Screeners Personal finance Crypto Industries Sports Fantasy NFL NBA MLB NHL College football College basketball Soccer MMA Yahoo Sports AM New on Yahoo Games Tech Selected edition USEnglish Mail Sign in Mail News Finance Sports Entertainment Life Yahoo Plus More... … Skip navigation linksSkip to main contentSkip to sidebarAdvertisementtop storiesUkraine warns situation on northern front has 'significantly worsened'The precise goal of Russia's new push in the northern Kharkiv region — which began in the early hours of Friday morning — is unclear. 'Ongoing battles in the border areas' »What is 'spaving' and why should buyers beware?Some Duke students walk out on Jerry Seinfeld's commencement speechTuna Crabs, neither tuna nor crabs, are swarming near San Diego'Completely different player': Djokovic 'concerned' about water bottle injuryAmericans are choking on surging fast-food pricesStories for you Sports·Yahoo SportsFormer NBA player Glen Davis sentenced to 40 months in prison for involvement in healthcare fraud schemeFormer NBA player Glen Davis was sentenced to 40 months in prison after his conviction for being involved in a scheme to defraud the league's healthcare plan.2 min read Thanks for your feedback! Sports·ProFootball Talk on NBC SportsNFL Schedule Release 2024: Primetime games, Thanksgiving and Christmas Day Schedule, International GamesAll the latest information on schedule and matchups for the 2024 NFL season.1 min read Thanks for your feedback! Technology·EngadgetHow to watch Google's I/O 2024 keynoteIt’s time for Google’s I/O 2024 conference. This event will spotlight Android 15 and Gemini, with room for plenty of surprises.2 min read Thanks for your feedback! Technology·Yahoo TechThe best noise-cancelling earbuds for 2024, tested and reviewedQuiet, cruel world! Drown the sound with our picks from Bose, Apple, Sony and more.6 min read Thanks for your feedback! Style·Yahoo Life ShoppingThe 9 best water shoes for women in 2024From rugged options for rocky beaches to cute, quick-drying espadrilles, these are the best women's water shoes, according to experts.5 min read Thanks for your feedback! Lifestyle·Yahoo Life Shopping27 last-minute Mother's Day gifts to shop nowIt's not too late! Score free, fast shipping on these last-minute gifts for Mom.2 min read Thanks for your feedback! NewsMotional delays commercial robotaxi plans amid restructuringMotional, the autonomous vehicle startup borne out of a $4 billion joint venture between Hyundai and automotive supplier Aptiv, will pause its commercial operations and delay plans to launch a driverless taxi service as it undergoes a restructuring, TechCrunch has learned. The aim is make progress on the core technology and the business model, while preserving capital, according to sources familiar with the changes. Thanks for your feedback! NewsApple’s Final Cut Camera lets filmmakers connect four cameras at onceThe latest version of Final Cut Pro introduces a new feature to speed up your shoot: Live Multicam. It’s a bold move from Apple, transforming your iPad into a multicam production studio, enabling creatives to connect and preview up to four cameras all at once, al in one place. From the command post, directors can remotely direct each video angle and dial in exposure, white balance, focus, and more, all within the Final Cut Camera app. Thanks for your feedback! NewsApple unveils the new 11-inch and 13-inch iPad Air with M2 chipApple is refreshing its iPad lineup today. And this launch is a bit overdue as the previous iPad Air was announced more than two years ago. The most important addition to the new iPad Air is that it now comes in two sizes. Customers can choose between an 11-inch display and a 13-inch display. Thanks for your feedback! NewsHere’s everything Apple just announced at its Let Loose event, including new iPad Pro with M4 chip, iPad Air, Apple Pencil and moreToday is Apple iPad Event day, and we’re ready to bring you all the iPad goodness you can stand, including if some of the rumors are true of what’s coming, like a new iPad Pro, iPad Air, Apple Pencil and a keyboard case. Don’t have time to watch? That’s ok — we’ve summed up the most important parts of the event below. Thanks for your feedback! NewsApple finally places front camera on iPad on the landscape edge — like it should beApple announced new iPads — two iPad Air models and the iPad Pro with M4 processor — at its “Let Loose” event on Tuesday. However, one of the important updates for people who take a lot of video calls was Apple shifting the camera to the landscape edge. Thanks for your feedback! Lifestyle·MoneywiseDave Ramsey says all Americans have ‘a shot’ at being millionaires — but people in 5 professions stand the best chanceThose who say it can’t be done … are “evil”4 min read Thanks for your feedback! Sports·Yahoo SportsNBA Draft Lottery: Hawks get No. 1 pick, despite 3 percent chance of winningThe Atlanta Hawks won the No. 1 overall selection in the NBA Draft Lottery. The Hawks had a 3 percent chance of winning the top pick.4 min read Thanks for your feedback! Sports·Yahoo Sports2024 NBA Mock Draft 7.0: Who will the Hawks take at No. 1? Our projections for every pick with lottery order now setWith the lottery order set, here's a look at Yahoo Sports' projections for both rounds of the 2024 NBA Draft.16 min read Thanks for your feedback! Business·Yahoo FinanceUtility stocks are on fire — here are Wall Street analysts' top picksUtility stocks are outperforming the broader markets. Here's a look at three top picks from analysts.5 min read Thanks for your feedback! Sports·Yahoo SportsDerrick Lewis strips off shorts, moons crowd in St. Louis after KO win over Rodrigo Nascimento“I appreciate St. Louis for letting me show my naked ass tonight.\"3 min read Thanks for your feedback! Sports·Yahoo SportsUFC St. Louis: Esteban Ribovics delivers wild head-kick KO to beat Terrance McKinney seconds into their fightIt took Esteban Ribovics only 37 seconds to get the win Saturday night.2 min read Thanks for your feedback! Business·Yahoo FinanceAustralian ambassador: 'American model is proving its resilience' despite threat from Chinese industrial policyChina may be outspending the US when it comes to industrial policy in sectors like electric vehicles and semiconductors, but America is winning on innovation where it can’t on price, according to one China expert.4 min read Thanks for your feedback! Business·Yahoo FinanceHere's 1 big investing mistake you are probably still makingMaybe a 5% CD isn't the best choice for your hard-earned money.3 min read Thanks for your feedback! Sports·Yahoo SportsRing announcer mistakingly names wrong winner of Cherneka Johnson-Nina Hughes bout in wild sceneLike Steve Harvey and the \"Moonlight\" debacle, Lt. Dan Hennessey made a brutal mistake on the mic on Sunday in Perth.2 min read Thanks for your feedback! Business·Yahoo FinanceFed officials stick to Powell’s higher-for-longer script as a key inflation reading loomsJay Powell’s colleagues spent the last week backing a stance the central bank chair hammered home at his last press conference: Interest rates will be staying higher for longer.5 min read Thanks for your feedback! Celebrity·Yahoo NewsWhy are social media users blocking celebrities and influencers on TikTok? A look at the #Blockout movementHere's why some social media users are blocking stars from their feeds after the Met Gala.3 min read Thanks for your feedback! Sports·Yahoo SportsNBA playoffs: Jayson Tatum, Celtics hold off late Cavaliers rally to take Game 3The Celtics now hold a 2-1 lead over the Cavaliers in their Eastern Conference semifinals series.3 min read Thanks for your feedback! Sports·Yahoo SportsNBA playoffs: P.J. Washington shines again as Mavericks hold off Thunder in Game 3, take 2-1 series leadP.J. Washington has scored 57 combined points in the last two games to lead Dallas past the Thunder.3 min read Thanks for your feedback! Sports·OUInsiderRed River Revenge: Sooners handle Texas, secure Big 12 ChampionshipThe Longhorns won in Austin, but the Sooners won the rematch for the Big 12 Championship on Saturday.5 min read Thanks for your feedback! Politics·Yahoo NewsBlinken, Sanders and Graham offer differing takes on latest State Dept. report on Israel's possible humanitarian violations in GazaAntony Blinken and Bernie Sanders praise Biden for withholding military aid to Israel. Lindsey Graham calls it the 'worst decision.'5 min read Thanks for your feedback! Business·Yahoo FinanceIs Austin’s hot housing market flipping in favor of buyers?The average home price in Austin, Texas, jumped by $170,000 during the pandemic. But the market is shifting in favor of buyers, and prices are beginning to come down.8 min read Thanks for your feedback! Lifestyle·Yahoo Life ShoppingThe 27 best Walmart deals to shop this weekend — save more than 80% on gardening supplies, tech items and moreSome major deals on board: A lovely vertical garden for just $40, a remarkable mini movie projector for a staggering $620 off and a handy Bissell upright vacuum for under $60.1 min read Thanks for your feedback! Entertainment·Yahoo TVSNL Recap: Maya Rudolph vogues her way back into 30 Rock in a Mother's Day-themed episodeThe 'SNL' alum revived her Beyoncé impression, with a new Cowboy Carter twist.4 min read Thanks for your feedback! Business·TechCrunchA reckoning is coming for emerging venture funds, and that, VCs say, is a good thingThousands of new venture capital funds have launched over the past few years, each hoping to carve out a long-term, lucrative place for themselves. PitchBook is tracking over 10,000 funds currently trying to raise money, and 45% of them are emerging fund managers, defined as a firm with less than three funds. For the most part, things seem to be shaking out quite nicely for emerging managers despite the economic headwinds.11 min read Thanks for your feedback! Lifestyle·Yahoo Life Shopping'None of my plants have died from overwatering since I started using this': This soil meter is on sale for just $14Make your garden the talk of the town with a little help from this friend.3 min read Thanks for your feedback! Lifestyle·Yahoo Life ShoppingThe T-shirt folding board shoppers say makes 'doing the laundry fun' is just $11 at AmazonThis problem-solving gadget takes the hassle out of getting your drawers and closets organized.3 min read Thanks for your feedback! Sports·Inside NebraskaBREAKING: Four-star QB TJ Lateef commits to NebraskaNebraska has landed their quarterback in 2025 in Orange (Cali.) Lutheran four-star TJ Lateef. Lateef committed to the Huskers two weeks after making an official visit to Lincoln for the Red-White Game.3 min read Thanks for your feedback! Business·Yahoo FinanceInflation and consumer spending updates ahead: What to know this weekA crucial reading of inflation faces investors in the week ahead after a string of disappointing reports to start the year dampened investors' interest rate cut hopes.7 min read Thanks for your feedback! Sports·Boiler UploadPurdue Baseball Drops Series at MichiganFor the second week in a row Purdue was able to win the Friday night opener of a key Big Ten series, but it also dropped the next two games to fall off the pace for the postseason. On Saturday Michigan beat Purdue 7-6 in walk-off fashion. On Sunday the Wolverines hit four home runs, three in the sixth inning, to take an 8-6 win and the series from the Boilers.5 min read Thanks for your feedback! Sports·OUInsiderOU sweeps Baylor, claims first regular season Big 12 title47. That is how may runs the Sooners' offense was responsible for putting on the Baylor Bears in the series this weekend2 min read Thanks for your feedback! Sports·Inside ND SportsNotre Dame Football Transfer Tracker for 2023-24 offseasonTracking Notre Dame football's outgoing transfers hitting the portal and incoming commitments from other schools1 min read Thanks for your feedback! Business·Yahoo FinancePrivate equity is helping banks shed some of their risksBanks are using \"credit risk transfers\" with private equity firms to help alleviate their regulatory burdens and protect against future losses. Thanks for your feedback! Sports·RivalsFact or Fiction: Five-star Solomon Thomas may flip to FloridaFive-star offensive lineman Solomon Thomas committed to Florida State in December.6 min read Thanks for your feedback! Lifestyle·Yahoo Life Shopping'Transformed my grilling experience': This No. 1 bestselling grill basket is just $26A barbecue enthusiast's dream, this gadget comes with a brush and heat-resistant glove.3 min read Thanks for your feedback! Sports·Yahoo SportsPirates pitching phenom Paul Skenes lives up to the hype in wild, rain-delayed debutThe Pirates topped the Cubs 10-9 in a game that offered a reminder that Skenes alone cannot save Pittsburgh.7 min read Thanks for your feedback! Lifestyle·Yahoo Life ShoppingThese 10 trending cleaning products — all under $20 — have thousands of five-star Amazon ratingsThe Pink Stuff, Scrub Daddy and more: Scour your space from top to bottom with essentials starting at just $5.4 min read Thanks for your feedback! Politics·HuffPostSpringsteen Fans Roast Trump For Bizarre Boast About Size Of New Jersey CrowdA spokesperson for the city of Wildwood said Trump spoke to 80,000 to 100,000 people, but video of the event made that hard to believe.3 min read Thanks for your feedback! Politics·AFPTrump, reciting songs and praising cannibals, draws yawns and raises eyebrowsFormer US president Donald Trump raised eyebrows among his no-nonsense New Jersey crowd at a rally Saturday when he recited a 1963 soul song in its entirety and referenced a fictional cannibal as \"great.\"\"A tenderhearted woman saw a poor, half-frozen snake,\" Trump said, reciting -- but not singing -- the song to the crowd.2 min read Thanks for your feedback! Politics·Fox NewsMassive Trump beach rally in deep blue NJ draws stark contrast to Biden's beach weekend: 'Biden could never'Critics on social media argue President Biden could not pull a massive crowd like former President Trump in Wildwood, New Jersey, as they slam the current president for his beach weekend.7 min read Thanks for your feedback! US·CNNA 19-year-old called 911 in a crisis and ended up dead. For advocates, it’s a call for a better way of policing“Please don’t shoot,” Notan Eva Costa, a 48-year-old Bangladeshi immigrant living in Queens, begged the two New York City police officers who entered her home after her teenage son called 911.9 min read Thanks for your feedback! Celebrity·SheKnowsInsiders Claim Kelly Preston’s Death Made John Travolta Do a 180 on This Part of His Life With ScientologyIt’s no secret that after Kelly Preston died in 2020, John Travolta has been rather low-key from the public eye. Despite a few appearances with their kids and an alleged romance blooming between him and Kristin Davis, Travolta has been quite private, and apparently, a lot has changed behind closed doors. An insider told Closer …2 min read Thanks for your feedback! US·NY PostThe city told a homeowner to hide his boat behind a fence — his creative and hilarious response went viralIs this guy the B.O.A.T., or what?2 min read Thanks for your feedback! Politics·SheKnowsA Super-Rare Clip of Barron Trump’s Voice Has the Internet Comparing Him to This Family MemberWhile Barron Trump may not be entering politics like his dad, former US President Donald Trump, and his siblings, he has something in common with his dad: their voices. Let us explain. An account called @realcherokeeowl shared a video clip of Barron at Mar-a-Lago, and it’s going viral on X, the app formerly known as …2 min read Thanks for your feedback! Celebrity·Miami HeraldDad reveals the last words his wife ever said. They were for their 4-year-old sonTaylor Odlozil opened up about his wife’s final moments after an 8-year battle with cancer and what she said to their son.2 min read Thanks for your feedback! Celebrity·SheKnowsKatie Holmes’s Daughter Suri Just Ensured Her Father Tom Will Have No Part in Her Theater CareerWith two parents who act, it’s no wonder that Katie Holmes and Tom Cruise’s daughter Suri Cruise got the acting bug. Not only did she star in her high school’s musical of Addams Family, which onlookers said she was “amazing” at, but she’s acting in local theater too! Along with that, eagle-eyed fans noticed a …2 min read Thanks for your feedback! Celebrity·PeopleMeghan Markle Wears Traditional Skirt Gifted to Her in Nigeria After Admitting She Needs to 'Wear More Color'The Duke and Duchess of Sussex have stepped out for their last day in Nigeria5 min read Thanks for your feedback! Celebrity·VarietyJennifer Lawrence Slams Mike Pence at GLAAD Media Awards: ‘Conversion Therapy Isn’t Real,’ Even Though ‘You Think It Worked on You’Ross Matthews wasn’t three words into his opening monologue at the 35th annual GLAAD Awards in New York City Saturday evening when a protester stood up from the audience to shout, “GLAAD is complicit in genocide.” The lone pro-Palestine advocate, blanketed by a wide-eyed room who let out a few jeers — “Who are you, you …5 min read Thanks for your feedback! Celebrity·PeoplePhoebe Cates and Kevin Kline's 2 Kids: All About Owen and Greta KlinePhoebe Cates and Kevin Kline share a son and daughter6 min read Thanks for your feedback! Celebrity·Fox NewsHugh Jackman's ex-wife Deborra-lee Furness learned she's 'strong and resilient' after splitHugh Jackman's ex-wife Deborra-lee Furness opened up about what she learned during her \"year of evolution\" following their split after 27 years together.3 min read Thanks for your feedback! Celebrity·SheKnowsJohn Travolta’s Alleged New Romance May Have a Major Hurdle on His EndWhile the internet and friends of the two are shipping John Travolta and Kristin Davis together, their alleged romance could have a huge hurdle on Travolta’s side. Insiders said to Closer Weekly on May 8 that Travolta is having a hard time moving on from the passing of his late wife, Kelly Preston. Now, this …2 min read Thanks for your feedback! Celebrity·PeopleWoman Learns She’s Expecting 'Perfect' Rainbow Baby, Then Finds Out She Has Breast Cancer (Exclusive)\"We're not the type of people to just lay down and cry,\" Tiffany Gagliardi, whose son is due in July, tells PEOPLE6 min read Thanks for your feedback! Celebrity·SheKnowsNicole Kidman Reportedly Continues to Be Estranged From One of Her Children, Sources ClaimNicole Kidman is a loving mother of four, and while two of her children are incredibly close with their father, her ex-husband, Tom Cruise, they reportedly have quite a different relationship with their mom. While her adopted daughter Bella is allegedly still on good terms with her, her adopted son Connor is reportedly estranged from …1 min read Thanks for your feedback! Celebrity·PeopleAnnaLynne McCord Jokes Her 'Clothes Evaporate' Around Boyfriend She 'Reconnected' with After Years Apart (Exclusive)The '90210' alum is dating British rugby player Danny Cipriani, after the pair first met on the dating app Raya many years ago3 min read Thanks for your feedback! World·Fox NewsIranian lawmaker declares Tehran obtained nuclear bombsU.S. and UN experts say Iran’s regime is dangerously close to becoming a nuclear-armed weapons state as officials in Tehran announce their capability to build atomic bombs.6 min read Thanks for your feedback! Politics·Business InsiderTrump leads his supporters in vulgar chants at Jersey Shore rallyDonald Trump attacked his hush money trial prosecutor and judge at a New Jersey rally. He claimed he was being indicted on \"bullshit\" charges.3 min read Thanks for your feedback! US·NBC NewsTrump, gun owners and Jan. 6 rioters: Tough-on-crime Justice Alito displays empathy for some criminal defendantsConservative Justice Samuel Alito, a former U.S. attorney with a long history of voting in favor of prosecutors, has shown signs of empathy for defendants.5 min read Thanks for your feedback! Business·Motley FoolFact or Fiction: Congress Stole From Social Security and Should Return the Money It's Taken, With InterestDid lawmakers really pilfer Social Security's piggy bank? Here's the truth.8 min read Thanks for your feedback! US·Akron Beacon JournalFox 8's Wayne Dawson recuperating from surgery, thanks viewers for well-wishesIn April, Fox 8's Wayne Dawson underwent a lengthy surgery at the Cleveland Clinic. According to a message posted Sunday, he continues to recover.1 min read Thanks for your feedback! US·Fox NewsMassachusetts man dies 2 months after becoming first person to receive successful pig kidney transplantA Massachusetts man who was the first recipient of a genetically modified pig kidney transplant died nearly two months after he underwent the procedure.2 min read Thanks for your feedback! Politics·The HillVance says he was ‘wrong’ in past remarks on TrumpSen. JD Vance (R-Ohio) said Sunday that his past remarks about then-candidate Donald Trump ahead of the 2016 election were “wrong.” CNN’s Dana Bash pressed Vance on a tweet that he posted in 2016 when the “Access Hollywood” tape of Trump surfaced that stated, “Fellow Christians, everyone is watching us. When we apologize for this…2 min read Thanks for your feedback! Politics·The IndependentPotential VP pick joins Trump on flight to raucous Jersey Shore rally after he nixed another hopefulMr Trump tells one former rival to ‘get ready’ and another to get lost as he stokes speculation around vice president pick3 min read Thanks for your feedback! Sports·MMA JunkieWorst leg break in MMA history? Be the judge, if you have the stomach to watchAnderson Silva, Conor McGregor and Chris Weidman move aside – this might be the most gruesome leg break in MMA history.1 min read Thanks for your feedback! Lifestyle·Tasting TableThe Store-Bought Tortilla Brand You Should Keep Out Of Your Grocery CartNot all flour tortillas are the same, as our taste testers found out. There's one brand that's best avoided if you want a tasty meal that holds together.3 min read Thanks for your feedback! US·WPIX New York City, NYMap: Will you see the northern lights again on Sunday?More \"very fast moving coronal mass ejections\" are expected to hit Earth's magnetic field on Sunday — here's how it impacts your odds of seeing the northern lights.2 min read Thanks for your feedback! US·WFXTWeymouth man who received first-of-its-kind pig kidney transplant has diedThe Weymouth man who became the first person to receive a genetically edited pig kidney in March has died, Mass General Hospital says.3 min read Thanks for your feedback! Sports·CNNLionel Messi appears unhappy with new MLS rule as he is forced to wait on sidelines before returning to the pitchLionel Messi appeared to cut a frustrated figure on the sidelines when a new Major League Soccer rule prevented him from immediately returning to the pitch following an injury check.2 min read Thanks for your feedback! World·Fox NewsHere's why Ireland is at boiling point over mass immigrationHundreds of protests in towns have sprung up in Ireland with people calling on the government to end what they say is an \"open borders\" globalist agenda that is putting the needs of migrants ahead of its citizens.11 min read Thanks for your feedback! Lifestyle·Daily Meal9 Chain Restaurants That Use The Highest-Quality SeafoodChain restaurants aren't necessarily known for quality. But these 9 chains distinguish themselves by serving the highest-quality seafood possible.10 min read Thanks for your feedback! Celebrity·BuzzFeedEmployees Who've Had Or Witnessed Scandalous Workplace Affairs Are Telling Their Stories, And Ohhh Boyyyy\"The company covered the whole thing up and blamed me. I quit before hitting my year mark.\"14 min read Thanks for your feedback! US·Patriot LedgerWeymouth man who had experimental pig kidney transplant has diedRichard Slayman, of Weymouth, had the surgery at Massachusetts General Hospital less than two months ago. When the 62-year-old left Mass General he said he had “one of the cleanest bills of health I’ve had in a long time.”2 min read Thanks for your feedback! Entertainment·Digital Trends5 sci-fi movies on Netflix you need to watch in May 2024Here are five sci-fi movies you need to watch on Netflix in May, including the sequel to an original space opera and an innovative action thriller.4 min read Thanks for your feedback! Sports·Steelers WireFormer Bears coach says Steelers QB Justin Fields was ‘hard to watch’One former Bears assistant was not impressed by Justin Fields.1 min read Thanks for your feedback! Entertainment·Louder Sound“Steve Winwood has his failings… I guess you can’t have everything”: The story of TrafficIt seems every member of the groundbreaking band paid a price for their involvement – but a three-album run of rare quality remains as testimony to their lofty creative intentions17 min read Thanks for your feedback! NextTrending Now1.NBA Draft Lottery2.Donald Trump3.Aurora Borealis4.Taylor Swift5.NASCAR Cup Series6.St. Louis Cardinals7.Eurovision8.Russia-Ukraine War9.Meghan Markle10.Minnesota VikingsAdvertisementWeatherGdanskView your LocationsDetect my locationView your LocationsPlease enable location service for your browserEnter City or ZipcodeTodayClear. Winds variable. The overnight low will be 39 °F (3.9 °C).58°39°MonSunny today with a high of 63 °F (17.2 °C) and a low of 42 °F (5.6 °C).63°42°TuePartly cloudy today with a high of 66 °F (18.9 °C) and a low of 39 °F (3.9 °C).66°39°WedMostly sunny today with a high of 68 °F (20 °C) and a low of 48 °F (8.9 °C).68°48°See moreScoreboardChange Sports to display different scoresTrending MLB NBA NCAAB NCAAF NFL NHL YesterdayTodayTomorrowNY 473rd 7:43IND 80TEX 1Top 7thCOL 2CIN 3Top 4thSF 0See moreDaily HoroscopeChange your horoscope signAquariusAriesCancerCapricornGeminiLeoLibraPiscesSagittariusScorpioTaurusVirgoTaurusMay 12 -You're feeling more than a little attached to someone, and that may or may not be a good thing! It's a good time to reconsider your relationships and decide what to do about some of them. See moreAdvertisement ADVERTISEMENT\n" ] } ], @@ -197,13 +367,71 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "id": "regulation-sheriff", "metadata": {}, "outputs": [], "source": [ + "def scrape_text(soup):\n", + " # Delete script and style elements\n", + " for script in soup([\"script\", \"style\"]):\n", + " script.extract()\n", + "\n", + " # Get text\n", + " text = soup.get_text()\n", + " \n", + " return text\n", + "\n", "def scrape_wmi():\n", - " return []" + " url = \"https://wmi.amu.edu.pl/\"\n", + "\n", + " page = requests.get(url)\n", + " soup = BeautifulSoup(page.content, 'html.parser')\n", + "\n", + " # Create list to store text elements\n", + " text_elements = []\n", + "\n", + " text = scrape_text(soup)\n", + " text_elements.append(text)\n", + "\n", + " # Find all links\n", + " links = soup.find_all('a')\n", + "\n", + " # Get href from links\n", + " links = [link.get('href') for link in links]\n", + "\n", + " # Get text from links\n", + " for link in links:\n", + " try:\n", + " page = requests.get(link)\n", + " soup = BeautifulSoup(page.content, 'html.parser')\n", + " text = scrape_text(soup)\n", + " text_elements.append(text)\n", + " except:\n", + " pass\n", + " \n", + " return text_elements" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "c022577a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "109" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(scrape_wmi())" ] }, { @@ -222,30 +450,136 @@ "### Ćwiczenie 4: Pobierz jak najwięcej słów w języku albańskim z serwisu glosbe.com." ] }, + { + "cell_type": "markdown", + "id": "06428e3d", + "metadata": {}, + "source": [ + "Rozumiem, że w tym zadaniu nie można skorzystać z biblioteki zawierającej np słownik z polskimi wyrazami (zbyt trywialne) - dlatego skorzystam ze słów z poprzedniego zadania, użyje lematyzacji i przetłumaczę je za pomocą serwisu" + ] + }, { "cell_type": "code", - "execution_count": null, + "execution_count": 44, "id": "surgical-ozone", "metadata": {}, "outputs": [], "source": [ - "def scrape_shqip():\n", - " return []" + "import spacy\n", + "\n", + "def scrape_shqip(limit: int = 10):\n", + " base_url = \"https://glosbe.com/pl/sq/\"\n", + " unique_polish_words = list(set(\" \".join(scrape_wmi()).split()))\n", + " unique_polish_words = [word.lower() for word in unique_polish_words if word.isalpha()]\n", + " unique_polish_words = unique_polish_words[:limit]\n", + "\n", + " print(f\"Polish words to translate: {unique_polish_words}\", end=\"\\n\\n\\n\")\n", + "\n", + " nlp = spacy.load(\"pl_core_news_sm\")\n", + " doc = nlp(\" \".join(unique_polish_words))\n", + "\n", + " albanian_translations = {}\n", + " for word in doc:\n", + " word = word.lemma_\n", + "\n", + " url = f\"{base_url}{word}\"\n", + " page = requests.get(url)\n", + " soup = BeautifulSoup(page.content, 'html.parser')\n", + "\n", + " try:\n", + " albanian_word = soup.find('li', {'data-element':'translation'})\n", + " albanian_word = albanian_word.find('h3')\n", + " albanian_word = albanian_word.get_text().strip()\n", + "\n", + " print(f\"{word} -> {albanian_word}\")\n", + " albanian_translations[word] = albanian_word\n", + " except:\n", + " print(f\"{word} -> None\")\n", + " albanian_translations[word] = None\n", + "\n", + " return albanian_translations" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "5b7804ab", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Polish words to translate: ['samorządu', 'ilorazowe', 'dużym', 'filozofii', 'zmienione', 'załączonych', 'wynikami', 'kampusie', 'powołać', 'matematycznego', 'uz', 'ostatniej', 'stopień', 'podręczników', 'advancedbeststudentgrant', 'filmy', 'powodu', 'infrastruktura', 'sesja', 'javascritp', 'wykładowcę', 'koordynatorką', 'minimalnych', 'administracyjnych', 'symulowania', 'soil', 'indeks', 'mail', 'konfigurujemy', 'skutki', 'analizując', 'humboldt', 'zainteresowane', 'trzyletnich', 'otwartością', 'mający', 'doradczyzielony', 'ustalonej', 'przykładów', 'czajkowskiizabela', 'sławomir', 'różniczkowychseminarium', 'przygotowuje', 'zdobywali', 'wjazd', 'wspinaczkowych', 'usługę', 'danychna', 'zastępowane', 'rozproszonym']\n", + "\n", + "\n", + "samorząd -> None\n", + "ilorazowy -> None\n", + "duży -> madh\n", + "filozofia -> filozofia\n", + "zmienić -> ndryshoj\n", + "załączony -> None\n", + "wynik -> rezultat\n", + "kampus -> None\n", + "powołać -> None\n", + "matematyczny -> None\n", + "uz -> None\n", + "ostatni -> vonë\n", + "stopień -> gradë\n", + "podręcznik -> libër shkollor\n", + "advancedbeststudentgrant -> None\n", + "film -> film\n", + "powód -> arsye\n", + "infrastruktura -> Infrastruktura\n", + "sesja -> sesion\n", + "Javascritp -> None\n", + "wykładowca -> mësimdhënës\n", + "koordynatorka -> None\n", + "minimalny -> None\n", + "administracyjny -> None\n", + "symulować -> None\n", + "soil -> None\n", + "indeks -> indeks\n", + "mail -> None\n", + "konfiguriwać -> None\n", + "skutek -> rezultat\n", + "analizować -> analizoj\n", + "humboldt -> None\n", + "zainteresować -> None\n", + "trzyletni -> None\n", + "otwartość -> None\n", + "mieć -> kam\n", + "doradczyzielon -> None\n", + "ustalić -> None\n", + "przykład -> shembull\n", + "czajkowskiizabel -> None\n", + "Sławomir -> None\n", + "różniczkowychseminarium -> None\n", + "przygotowywać -> None\n", + "zdobywać -> fitoj\n", + "wjazd -> aderim\n", + "wspinaczkowy -> None\n", + "usługa -> shërbim\n", + "danychno -> None\n", + "zastępować -> None\n", + "rozproszony -> None\n" + ] + } + ], + "source": [ + "albanian_translations = scrape_shqip(limit=50)" ] } ], "metadata": { "author": "Rafał Jaworski", "email": "rjawor@amu.edu.pl", - "lang": "pl", - "subtitle": "9,10. Web scraping", - "title": "Komputerowe wspomaganie tłumaczenia", - "year": "2021", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, + "lang": "pl", "language_info": { "codemirror_mode": { "name": "ipython", @@ -256,8 +590,11 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" - } + "version": "3.10.14" + }, + "subtitle": "9,10. Web scraping", + "title": "Komputerowe wspomaganie tłumaczenia", + "year": "2021" }, "nbformat": 4, "nbformat_minor": 5