Measure Similarity Between Two Sentences Using Cosine Similarity in Python

Mithilesh Pradhan
Updated on 26-Sep-2023 12:03:35

2K+ Views

Introduction Natural Language Processing for finding the semantic similarity between sentences, words, or text is very common in modern use cases. There are numerous ways to calculate the similarity between texts. One such popular method is cosine similarity. It is used to find the similarity between two vectors that are non-zero in value and measures the cosine of the angle between the two vectors using dot product formula notation. Through this article let us briefly explore cosine similarity and see its implementation using Python. Cosine similarity – Finding similarity between two texts Cosine Similarity is defined as the cosine of ... Read More

Handling Sparsity Issues in Recommendation System

Mithilesh Pradhan
Updated on 22-Sep-2023 13:26:46

455 Views

Introduction In Recommendation Systems, Collaborative filtering is one of the approaches to building a model and finding seminaries between users. This concept is highly used in Ecommerce sites and OTT and video-sharing platforms. One of the highly talked about issues that such systems face while in the initial modeling phase is that of data sparsity, which occurs when only a few users give ratings or reviews on the platform and are in any way involved in the interaction. In this article let us understand the problem of data sparsity in the Recommendation System and know about ways to handle it. ... Read More

Difference Between Training and Testing Data

Mithilesh Pradhan
Updated on 22-Sep-2023 12:55:56

7K+ Views

Introduction In Machine Learning, a good model is generated if we have a good representation and amount of data. Data may be divided into different sets that serve a different purposes while training a model. Two very useful and common sets of data are the training and testing set. The training set is the part of the original dataset used to train the model and find a good fit. Testing data is part of the original data used to validate the model train and analyze the metrics calculated. In this article lets us explore training and testing data sets in ... Read More

Custom Corpus in NLP

Mithilesh Pradhan
Updated on 22-Sep-2023 12:12:30

461 Views

Introduction Corpus is known as a collection of text documents that are readable by a machine. Corpus has a particular structure to it. Various NLP operations can be performed on a corpus. Corpus readers are utilities that can read through these text files. Custom corpus is generated using NLTK data package. A special convention is followed to create a custom corpus. Corpora is the plural form of a corpus. In this article let us understand briefly about corpora and how to create a custom corpus. Custom corpus A corpus can be in any of the given formats. From original ... Read More

Create Linked List from Given Array in C++ Program

Hafeezul Kareem
Updated on 15-Sep-2023 02:23:32

28K+ Views

In this tutorial, we are going to learn how to create a linked list from the given array.Let's see the steps to solve the problem.Initialize the array with dummy data.Write the struct node.Iterate over the array.Create a new node with the data.Insert the new node into the linked list.Print the linked list.ExampleLet's see the code.#include using namespace std; struct Node {    int data;    Node* next; }; struct Node* newNode(int data) {    Node* node = new Node;    node->data = data;    node->next = NULL;    return node; } void insertNewNode(Node** root, int data) {    Node* ... Read More

Use an Image as a Button in Tkinter

Dev Prakash Sharma
Updated on 15-Sep-2023 02:22:26

36K+ Views

In this example, we will create a rounded button in a window that can be used in many other applications like forms, games, dialogue boxes, etc.The best way to create rounded buttons in Tkinter is to use the desired images of buttons and turn it into a clickable button in the frame. That is really possible by using PhotoImage() function which grabs the desired image of the button.So, the following steps make the desired image a button, First, we will create a dummy button which can be used to make the image clickable.Grab the image from the source using PhotoImage(file) ... Read More

Structs in Arduino Program

Yash Sanghvi
Updated on 15-Sep-2023 02:21:17

46K+ Views

A struct is simply a collection of different types of variable. Structs in Arduino mimic the structs in C language. So, if you are familiar with C structs, Arduino structs shouldn’t be an issue. The struct declaration syntax is as follows −Syntaxstruct structName{    item1_type item1_name;    item2_type item2_name;    .    .    .    itemN_type itemN_name; }An example is given below −Examplestruct student{    String name;    int age;    int roll_no; }The elements of a struct are accessed using the . (dot) notation. This notation can be used for both reading the elements of a struct, or changing ... Read More

Differences Between Procedural and Object-Oriented Programming

Kiran Kumar Panigrahi
Updated on 15-Sep-2023 02:20:07

40K+ Views

Both Procedural Programming and Object Oriented Programming are high-level languages in programming world and are widely used in the development of applications. On the basis of nature of developing the code, both languages have different approaches on basis of which both are differentiate from each other. In this article, we will discuss the important differences between procedural oriented programming and object oriented programming. But before going into the differences, let's start with some basics. What is Procedural Programming? Procedural Programming is a programming language that follows a step-by-step approach to break down a task into a collection of variables ... Read More

Enter Key Press Event in JavaScript

AmitDiwan
Updated on 15-Sep-2023 02:16:05

26K+ Views

For ENTER key press event, you can call a function on −onkeypress=”yourFunctionName”Use the ENTER’s keycode 13.Example Live Demo Document    function enterKeyPressed(event) {       if (event.keyCode == 13) {          console.log("Enter key is pressed");          return true;       } else {          return false;       }    } To run the above program, save the file name "anyName.html (index.html)" and right click on the file. Select the option "Open with Live Server" in VS Code editor.OutputThis will produce the following output −On pressing ENTER key, the following output is visible on console −

Convert Array of Strings to Array of Numbers in JavaScript

Imran Alam
Updated on 15-Sep-2023 02:14:31

30K+ Views

In JavaScript, there are different ways to convert an array of strings to an array of numbers. The first way is to use the built-in parseInt() method, and the second way is to use a type conversion function, and the third one is to use the unary + operator.Using the parseInt() methodThe parseInt() method is a built-in function in JavaScript that takes a string as an argument and returns a number. This method can be used to convert an array of strings to an array of numbers.SyntaxThe syntax of the parseInt() method is as follows −parseInt(string, radix);ParametersString − The string ... Read More

Advertisements