js |
JavaScriptタグが付けられた新着投稿 - Qiita |
覚えておくと良いNavigation barの作り方 tailwind & react |
https://qiita.com/HYEONJAE/items/2ea8ba6a2f40f96fc05f
|
navbar |
2023-04-09 23:44:21 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
kintone ChatGPTフィールド評価プラグイン |
https://qiita.com/zackey_/items/893aa434aad94c874b7a
|
kintonechatgpt |
2023-04-09 23:11:32 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
ACMのDNS検証で使用するCNAMEレコードは、特殊な使い方をしている |
https://qiita.com/kisama2000/items/c9e20ee27fb60ada4ed7
|
alias |
2023-04-09 23:52:00 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
試してみよう!Oracle23c-free |
https://qiita.com/KO_YAmajun/items/eb260e741cfdff082d38
|
oraclecfreedockercompose |
2023-04-09 23:45:38 |
golang |
Goタグが付けられた新着投稿 - Qiita |
[HireRoo]で出題される入出力問題の解答方法 |
https://qiita.com/kengo-sk8/items/0448e3e5de3f7d708563
|
hireroo |
2023-04-09 23:21:22 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
Azure Storage Explorerを使う(Azure Blob~Azure VMのファイル移動) |
https://qiita.com/Higemal/items/bb3d0bbc939c07bc4119
|
azureblob |
2023-04-09 23:34:51 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
GitHubのCompare changes機能について:ブランチ比較する場合とコミット比較する場合のdiff確認方法 |
https://qiita.com/Ryo-0131/items/9cff5c6407f583d9e5d3
|
comparechanges |
2023-04-09 23:50:59 |
海外TECH |
MakeUseOf |
How to Fix the “Package Could Not Be Registered” Photos Error in Windows 10 & 11 |
https://www.makeuseof.com/package-could-not-be-registered-photos-windows/
|
windows |
2023-04-09 14:15:16 |
海外TECH |
DEV Community |
Best Ways to Strip Punctuation from Strings in Python and JavaScript |
https://dev.to/aradwan20/best-ways-to-strip-punctuation-from-strings-in-python-and-javascript-14j7
|
Best Ways to Strip Punctuation from Strings in Python and JavaScriptWhy Do you Need to remove punctuation In various text processing tasks it is often necessary to remove punctuation from strings to facilitate analysis comparisons or other manipulations Punctuation marks can create noise in the data and impede the performance of algorithms in natural language processing sentiment analysis or text mining applications This article will explore the best ways to strip punctuation from a string in Python and JavaScript discussing the most efficient and widely used methods code examples and use cases The Importance of Removing PunctuationsRemoving punctuation is crucial in several situations Text normalization Ensuring all text data conforms to a standard format makes it easier to analyze and process Text comparison Improving the accuracy of string matching or searching algorithms by eliminating irrelevant characters Tokenization Breaking text into words or phrases for further analysis such as in natural language processing or machine learning applications Data cleaning Preparing data for analysis by removing unnecessary or distracting characters Challenges in Stripping Punctuation MarksThe main challenges in stripping punctuation from strings include Performance Efficiently removing punctuation without consuming excessive computational resources especially when processing large volumes of text Language support Handling text in different languages which may have unique punctuation rules or character sets Customization Providing flexibility to include or exclude specific punctuation marks based on the requirements of a given task Python Stripping PunctuationMethod Using str translate and string punctuationimport stringdef remove punctuation text return text translate str maketrans string punctuation example Hello Nerds How s it going print remove punctuation example This method uses the str translate method in combination with string punctuation which contains a list of common punctuation symbols and marks str maketrans creates a translation table that maps punctuation characters to None effectively removing them from the input text Method Using list comprehension string punctuation import stringdef remove punctuation text return join c for c in text if c not in string punctuation example Hello Nerds How s it going print remove punctuation example This method employs a list comprehension as string punctuation will give all sets of punctuation to filter out punctuation marks from the input text and then join the remaining characters to a new string to form the output string Method Using re module Regular Expressions import reimport stringdef remove punctuation text Create a pattern that matches punctuation characters pattern f re escape string punctuation Substitute matched punctuation characters with an empty string return re sub pattern text example Hello Nerds How s it going print remove punctuation example This method uses the re module to create a pattern that matches punctuation characters then substitutes them with an empty string It provides more flexibility for customizing the pattern to match specific characters or groups of characters JavaScript Stripping PunctuationMethod Using regular expressionsfunction removePunctuation text return text replace w s g const example Hello Nerds How s it going console log removePunctuation example In this method we use the replace function with a regular expression that matches any non word character excluding whitespace characters or underscores These matched characters are then replaced with an empty string Method Using Array prototype filter and Array prototype join function removePunctuation text Convert the input string to an array of characters const charArray text split Define a regular expression pattern that matches punctuation characters const punctuationPattern w s g Filter the array to exclude punctuation characters const filteredArray charArray filter char gt punctuationPattern test char Join the filtered array back into a string return filteredArray join const example Hello Nerds How s it going console log removePunctuation example This method converts the input string into an array of characters filters out punctuation using Array prototype filter and RegExp prototype test and then joins the remaining characters back into a string using Array prototype join This approach is similar to the list comprehension method in Python and allows for more granular control over the filtering process Real world Use CasesCase Sentiment analysisStripping punctuation from text data can improve the performance of sentiment analysis algorithms by ensuring that words are accurately identified and compared Pythonimport stringdef preprocess text text Remove punctuation and convert text to lowercase return join c for c in text if c not in string punctuation lower print preprocess text Hello Nerds How s it going JavaScriptfunction preprocessText text Remove punctuation and convert text to lowercase return text replace w s g toLowerCase const example I m so happy this is great console log preprocessText example Case Web scrapingWhen extracting text from websites it s often necessary to remove extraneous characters like punctuation before further processing or analysis Pythonfrom bs import BeautifulSoupimport requestsimport stringdef extract and clean text url response requests get url soup BeautifulSoup response content html parser raw text soup get text return join c for c in raw text if c not in string punctuation print extract and clean text JavaScriptconst axios require axios const cheerio require cheerio async function extractAndCleanText url Fetch the web page content const response await axios get url Load the content into Cheerio const cheerio load response data Extract the text from the body element const rawText body text Remove punctuation from the extracted text return rawText replace w s g const exampleUrl extractAndCleanText exampleUrl then cleanText gt console log cleanText Case Data preprocessingIn machine learning or natural language processing tasks it s essential to preprocess text data by removing punctuation and other irrelevant characters Pythonimport pandas as pdimport stringdef preprocess dataframe df column name df column name df column name apply lambda x join c for c in x if c not in string punctuation return dfdata text Hello Nerds How s it going This is a test df pd DataFrame data print preprocess dataframe df text JavaScriptconst data text Hello Nerds text How s it going text This is a test function preprocessData data columnName return data map item gt item columnName item columnName replace w s g return item console log preprocessData data text In this example we preprocess text data in a dataframe Python or an array of objects JavaScript by removing punctuation from a specified column This is a common step when preparing data for machine learning or natural language processing tasks These additional code samples and use cases demonstrate the versatility of all the methods used for stripping punctuation from strings in both Python and JavaScript Understanding the unique features advantages and disadvantages of each method can help developers choose the best approach for their specific requirements in various real world scenarios such as text analysis data preprocessing or web scraping applications ConclusionStripping punctuation from strings is a critical aspect of text preprocessing in various applications such as sentiment analysis natural language processing web scraping and data cleaning Python and JavaScript both offer several effective methods to remove punctuation from strings each with its unique features advantages and disadvantages This article explored and compared these different methods together providing code samples and real world use cases to demonstrate their applicability By understanding the nuances of each method and its performance developers can make informed decisions on the best approach for the specific needs of their applications Ultimately mastering these techniques contributes to the efficiency and accuracy of text processing and analysis across a wide range of applications |
2023-04-09 14:48:39 |
海外TECH |
DEV Community |
How to Build Your First GitHub App with JavaScript and GitHub API: Easy and Fast |
https://dev.to/codewithsadee/how-to-build-your-first-github-app-with-javascript-and-github-api-easy-and-fast-50jc
|
How to Build Your First GitHub App with JavaScript and GitHub API Easy and FastIn this video we ll show you how to build a simple fast and easy web application using the GitHub API and JavaScript We ll use a dark and light theme and responsive design so that your app looks great on any device If you re looking to learn how to build a web application using the GitHub API then this is the video for you We ll show you everything you need to know to build a simple web application This is a great beginner s guide to web development and working with API so be sure to watch it Source codeStarter fileFigma UIGitHub API Postman️Timestamps▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Demo Demo testing accessibility Demo testing responsive Project stucture and initiallization Skip to content Header Light and dark theme Initial mian js file and header functionality Profile section Tab and tab content section Initial the api js file Working with API Search API integration Profile API integration Repository API integration Fork repo API integration Follower API integration Following API integration Media queries |
2023-04-09 14:08:09 |
海外TECH |
Engadget |
Hitting the Books: Tech can't fix what's broken in American policing |
https://www.engadget.com/hitting-the-books-more-than-a-glitch-meredith-broussard-mit-press-143009017.html?src=rss
|
Hitting the Books Tech can x t fix what x s broken in American policingIt s never been about safety as much as it has control serving and protecting only to the benefit of the status quo Clearview AI PredPol Shotspotter they re all Carolyn Bryant Donham s testimony behind a veneer of technological validity ーa shiny black box to dazzle the masses while giving the police yet another excuse to fatally bungle their search warrants In More than a Glitch data journalist and New York University Associate Professor of Journalism Dr Meredith Broussard explores how and why we thought automating aspects of already racially skewed legal banking and social systems would be a good idea From facial recognition tech that doesn t work on dark skinned folks to mortgage approval algorithms that don t work for dark skinned folks Broussard points to a dishearteningly broad array of initiatives that done more harm than good regardless of their intention In the excerpt below Dr Broussard looks at America s technochauavnistic history of predictive policing nbsp MIT PressExcerpted from More than a Glitch Confronting Race Gender and Ability Bias nbsp by Meredith Broussard Reprinted with permission from The MIT Press Copyright Predictive policing comes from the “broken windows era of policing and is usually credited to William Bratton former New York City police commissioner and LAPD chief As NYC police commissioner Bratton launched CompStat which is perhaps the best known example of data driven policing because it appeared as an antagonist called “Comstat on season three of HBO s The Wire “CompStat a management model linking crime and enforcement statistics is multifaceted it serves as a crime control strategy a personnel performance and accountability metric and a resource management tool writes sociologist Sarah Brayne in her book Predict and Surveil “Crime data is collected in real time then mapped and analyzed in preparation for weekly crime control strategy meetings between police executives and precinct commanders CompStat was widely adopted by police forces in major American cities in the s and s By relying heavily on crime statistics as a performance metric the CompStat era trained police and bureaucrats to prioritize quantification over accountability Additionally the weekly meetings about crime statistics served as rituals of quantification that led the participants to believe in the numbers in a way that created collective solidarity and fostered what organizational behaviorists Melissa Mazmanian and Christine Beckman call “an underlying belief in the objective authority of numbers to motivate action assess success and drive continuous organizational growth In other words technochauvinism became the culture inside departments that adopted CompStat and other such systems Organizational processes and controls became oriented around numbers that were believed to be “objective and “neutral This paved the way for the adoption of AI and computer models to intensify policingーand intensify surveillance and harassment in communities that were already over policed Computer models are only the latest trend in a long history of people imagining that software applied to crime will make us safer In Black Software Charlton McIlwain traced the history of police imagining that software equals salvation as far back as the s the dawn of the computational era Back then Thomas J Watson Jr the head of IBM was trying to popularize computers so more people would buy them Watson had also committed financially and existentially to the War on Poverty declared by President Lyndon Johnson upon his election in “Watson searched for opportunities to be relevant McIlwain writes “He said he wanted to help address the social ills that plagued society particularly the plight of America s urban poor He didn t know what he was doing Watson wanted to sell computers and software so he offered his company s computational expertise for an area that he knew nothing about in order to solve a social problem that he didn t understand using tools that the social problem experts didn t understand He succeeded and it set up a dynamic between Big Tech and policing that still persists Software firms like Palantir Clearview AI and PredPol create biased targeting software that they label “predictive policing as if it were a positive innovation They convince police departments to spend taxpayer dollars on biased software that ends up making citizens lives worse In the previous chapter we saw how facial recognition technology leads police to persecute innocent people after a crime has been committed Predictive policing technology leads police to pursue innocent people before a crime even takes place It s trIcky to write about specific policing software because what Chicago s police department does is not exactly the same as what LAPD or NYPD does It is hard to say exactly what is happening in each police agency because the technology is changing constantly and is being deployed in different ways The exact specifications tend to be buried in vendor contracts Even if a police department buys software it is not necessarily being used nor is it being used in precisely the way it was intended Context matters and so does the exact implementation of technology as well as the people who use it Consider license plate readers which are used to collect tolls or to conduct surveillance Automated license plate readers used by a state transportation authority to automatically collect tolls is probably an acceptable use of AI and automated license plate reader technologyーif the data is not stored for a long time The same license plate reader tech used by police as part of dragnet surveillance with data stored indefinitely is problematic Every time the public has become aware of some predictive policing measure controversy has erupted Consider the person based predictive policing enacted by the Pasco County Sheriff s Office in Florida which created a watchlist of people it considered future criminals Tampa Bay Times reporters Kathleen McGrory and Neil Bedi won a Pulitzer for their story about how the Pasco County Sheriff s Office generated lists of people it considered likely to break the law The list was compiled by using data on arrest histories and unspecified intelligence coupled with arbitrary decisions by police analysts The sheriff s department sent deputies to monitor and harass the people on the watchlist Often the deputies lacked probable cause search warrants or evidence of a crime In five years almost people were caught up in the systematic harassment labeled “Intelligence Led Policing Notably a large percentage of the people on the watchlist were BIPOC The Pasco program started in shortly after Chris Nocco took office as sheriff Nocco came up with the idea to “reform the department with data driven initiatives “For years nobody really understood how this worked and the public wasn t aware of what was going on said Bedi explaining the reporting project The sheriff built a “controversial data driven approach to policing He also built a wide circle of powerful friends including local and national politicians who didn t question his actions The harassment didn t stop there however Separately the Sheriff s Office created a list of schoolchildren it considered likely to become future criminals The office gathered data from local schools including protected information like children s grades school attendance records and child welfare histories Parents and teachers were not told that children were designated as future criminals nor did they understand that the students private data was being weaponized The school system s superintendent initially didn t realize the police had access to student data said Kathleen McGrory Once the investigation was published civil liberties groups denounced the intelligence programs Thirty groups formed a coalition to protest and four of the targeted people brought lawsuits against the agency Two bills were proposed to prevent this kind of invasion and misuse in the future The federal Department of Education opened an investigation into the data sharing between the Sheriff s Office and the local school district Fortunately as a result police analysts will no longer have access to student grades Many people imagine that using more technology will make things “fairer This is behind the idea of using machines instead of judges an idea that surfaces periodically among lawyers and computer scientists We see it in the adoption of body worn cameras an initiative that has been growing since LAPD officers brutally assaulted Rodney King in and the attack was captured on a home camcorder There s an imaginary world where everything is captured on video there are perfectly fair and objective algorithms that adjudicate what happens in the video feed facial recognition identifies bad actors and the heroic police officers go in and save the day and capture the bad guys This fantasy is taken to its logical conclusion in the film Minority Report where Tom Cruise plays a police officer who arrests people before they commit crimes on the recommendation of some teenagers with precognition who are held captive in a swimming pool full of goo “It s just like Minority Report a police officer marveled to sociologist Sarah Brayne when the two were discussing Palantir s policing software What makes this situation additionally difficult is the fact that many of the people involved in the chain are not malevolent For example my cousin who is white was a state police officer for years He s wonderful and kind and honest and upstanding and exactly the person I would call on if I were in trouble He and his family are very dear to me and I to them I believe in the law and I believe in law enforcement in the abstract in the way that many people do when they have the privilege of not interacting with or being targeted by law enforcement or the courts But the origins of policing are problematic for Black people like me and the frequency of egregious abuses by police is out of control in today s United States Police technology and machine fairness are the reasons why we need to pause and fix the human system before implementing any kind of digital system in policing The current system of policing in the United States with the Fraternal Order of Police and the uniforms and so on began in South Carolina Specifically it emerged in the s in Charleston South Carolina as a slave patrol “It was quite literally a professional force of white free people who came together to maintain social control of black enslaved people living inside the city of Charleston said ACLU Policing Policy Director Paige Fernandez in a podcast “They came together for the sole purpose of ensuring that enslaved black people did not organize and revolt and push back on slavery That is the first example of a modern police department in the United States In her book Dark Matters Surveillance of Blackness scholar Simone Brown connects modern surveillance of Black bodies to chattel slavery via lantern laws which were eighteenth century laws in New York City requiring Black or mixed race people to carry a lantern if out at night unaccompanied by a white person Scholar Josh Scannell sees lantern laws as the precedent for today s policy of police using floodlights to illuminate high crime areas all night long People who live in heavily policed neighborhoods never get the peaceful cloak of darkness as floodlights make it artificially light all night long and the loud drone of the generators for the lights makes the neighborhood noisier The ACLU s Fernandez draws a line from slave patrols maintaining control over Black people to the development of police departments to the implementation of Jim Crow era rules and laws to police enforcing segregation during the civil rights era and inciting violence against peaceful protestors to escalating police violence against Black and Brown people and leading to the Black Lives Matter movement Fernandez points out that the police tear gassed and pepper sprayed peaceful protestors in the summer of fired rubber bullets at protestors charged at protestors and used techniques like kettling to corner protestors into closed spaces where violence could be inflicted more easily The statistics paint a grim picture “Black people are times more likely than white people to be killed by police when Blacks are not attacking or do not have a weapon George Floyd is an example writes sociologist Rashawn Ray in a Brookings Institute policy brief about police accountability “Black teenagers are times more likely than white teenagers to be killed by police That s Tamir Rice and Antwon Rose A Black person is killed about every hours in the United States That s Jonathan Ferrell and Korryn Gaines One out of every one thousand Black men can expect to be killed by police violence over the life course This is Tamir Rice and Philando Castile When Derek Chauvin the police officer who killed George Floyd was found guilty it was remarkable because police are so rarely held accountable for violence against Black and Brown bodies Reform is needed That reform however will not be found in machines This article originally appeared on Engadget at |
2023-04-09 14:30:09 |
ニュース |
@日本経済新聞 電子版 |
神奈川県知事選挙、黒岩祐治氏は笑顔なき4選
https://t.co/kFXsyPQWU8 |
https://twitter.com/nikkei/statuses/1645065895549747202
|
神奈川県知事選挙 |
2023-04-09 14:07:28 |
ニュース |
BBC News - Home |
Maia and Rina Dee: Funerals of sisters killed in occupied West Bank taking place |
https://www.bbc.co.uk/news/world-middle-east-65224751?at_medium=RSS&at_campaign=KARANGA
|
family |
2023-04-09 14:37:01 |
ニュース |
BBC News - Home |
Pope Francis: Easter Mass brings relief to public after pontiff's illness |
https://www.bbc.co.uk/news/world-europe-65226916?at_medium=RSS&at_campaign=KARANGA
|
square |
2023-04-09 14:49:33 |
コメント
コメントを投稿