Training a Tokenizer and Filtering Stop Words in a Sentence

Mithilesh Pradhan
Updated on 27-Feb-2025 17:41:45

277 Views

Introduction In NLP tokenizing text into sentences is a very crucial preprocessing task. Tokenization is the process of breaking the text corpus into individual sentences. In NLTK, the default tokenizer does a good task to tokenize text however it fails to do so in cases where the text contains punctuations, symbols, etc. that are non-standard. In such cases, we need to train a tokenizer. In this article let us explore the training of a tokenizer and also see the usage of filter words or stopwords. Tokenizing a Sentence in NLP The default tokenizer in NLTK can be used on the ... Read More

Set Up Pygame with Eclipse

Tapas Kumar Ghosh
Updated on 27-Feb-2025 17:36:56

370 Views

The pygame is the name of the module of Python that helps to build the code for graphics such as rectangles, squares, circles, etc. It is also used the write the code for animation programs in Python. Eclipse is famous for Java IDE but here we have to set the environment of Python to run the program based on Pygame. System requirement Memory: 4 GB CPU: Intel Core ... Read More

Flight Price Checker Using Python and Selenium

Atharva Shah
Updated on 27-Feb-2025 17:32:04

851 Views

Web scraping has been a useful technique for extracting data from websites for various purposes, including price checking for airline tickets. In this article, we will explore how to build a flight price checker using Selenium, a popular web testing automation tool. By leveraging Selenium's capabilities, we can automate the process of collecting and comparing prices for flights across different airlines, saving time and effort for users. Setup Firefox Executable Download the Firefox browser installer from here Once downloaded, install the browser and an exe file will be placed automatically in C:\Program Files\Mozilla Firefox\firefox.exe. We will be needing it ... Read More

Fill NA in Multiple Columns In-Place in Python Pandas

Jaisshree
Updated on 27-Feb-2025 17:29:05

3K+ Views

Python has an open-source built-in library called Pandas for data analysis and manipulation. It has a well-defined data structure called DataFrame, similar to a table. It can also be used for writing and reading data from various types of files like CSV, Excel, SQL databases, etc. fillna() is a method which is used to fill missing (NaN/Null) values in a Pandas DataFrame or Series. The missing values are filled with a definite value or another specified method along with the method call. Syntax object_name.fillna(value, method, limit, axis, inplace, downcast) The fillna() method returns the same input DataFrame or Series ... Read More

Difference Between re.match, re.search, and re.findall Methods in Python

SaiKrishna Tavva
Updated on 27-Feb-2025 17:24:17

6K+ Views

Python's re module is useful while working with Regular Expressions, allowing us to search, match and manipulate strings by following specific patterns. re.match(): Checks if a given pattern matches at the beginning of a string. If a match is found, it returns a match object. re.search(): Scans the entire string for the first occurrence of the specified pattern. If it finds a match, it returns a match object. re.findall(): Finds all occurrences of a pattern within the string and returns them as a list. The re.match() ... Read More

Find the First Date of a Given Year Using Python

SaiKrishna Tavva
Updated on 27-Feb-2025 17:04:07

6K+ Views

The datetime module in Python can be used to find the first day of the given year. In general, this datetime module is mostly used for manipulating dates and times. Some of the Common approaches to print the first day of the given year by using Python are as follows. Datetime Module: Widely used library for manipulating dates and times in various ways. Calendar Module: Provides functions related ... Read More

Generate Sequences in Python

SaiKrishna Tavva
Updated on 27-Feb-2025 16:38:42

2K+ Views

A sequence is a positionally ordered collection of items, where each item can be accessed using its index number. The first element's index starts at 0. We use square brackets [] with the desired index to access an element in a sequence. If the sequence contains n items, the last item is accessed using the index n-1. In Python, there are built-in sequence types such as lists, strings, tuples, ranges, and bytes. These sequence types are classified into mutable and immutable. The mutable sequence types are those whose data can be changed after creation such, as list and byte arrays. ... Read More

Create Soft Link of a File Using Python

SaiKrishna Tavva
Updated on 27-Feb-2025 16:38:09

1K+ Views

Creating symbolic links (or soft links) in Python can be done using the OS module. A symbolic link is a special type of file that points to another file or directory, allowing you to access it under a different pathname. This can be useful for various reasons, such as creating shortcuts or managing different versions of files. The following methods provide different ways to create symbolic links. Using os.symlink() Function Using pathlib.Path.symlink_to() Function Using Command Line with subprocess Module Using 'os.symlink()' Function The most straightforward way to ... Read More

Find Two Elements Whose Sum is Closest to Zero in Java

Ashin Vincent
Updated on 27-Feb-2025 13:28:34

182 Views

In this article we will learn how to find the two elements in an array whose sum is closest to zero. The array can contain both positive and negative values as well. Let's understand with the help of an example. Example Let's take an array with the following elements − arr = {3, -56, -76, -32, 45, 77, -14, 13, 92, 37} Here, two elements whose sum is closest to zero are 77 and -76, and their sum is 1. Note: In this example we have 77 and -76, which will give the sum as 1, and also ... Read More

Find Square Root of a Number Without the sqrt() Method in Java

Ashin Vincent
Updated on 27-Feb-2025 13:15:02

269 Views

In Java, we can easily find the square root of a number using the inbuilt function 'Math.sqrt()’. But sometimes during an interview, the interviewer may ask to write the code from scratch without using inbuilt functions. So in this article, we will discuss the different ways to find the square root of a number without using the sqrt method. 1.Brute Force Method In this brute force method of calculating the square root of a number, first we check if the input is valid or not, and if the input is 0 or 1, we directly return the same number as ... Read More

Advertisements