Giter Club home page Giter Club logo

stringsimilarity.cpp's Introduction

StringSimilarity.cpp - C++ Classes for Calculating String Similarity Using Character Embeddings

This repository contains C++ classes CStringEmbedding and CStringEmbeddings for calculating string similarity using character embeddings.

Overview

The CStringEmbedding class is responsible for creating embeddings for individual strings by counting the occurrences of characters. The CStringEmbeddings class manages a collection of string embeddings and provides methods for finding similar strings based on their embeddings.

Installation

To use this package, you can clone the repository and compile it using a C++ compiler:

git clone https://github.com/NIR3X/StringSimilarity.cpp
cd StringSimilarity.cpp
make

Usage

To use these classes, follow these steps:

  1. Include the header file StringSimilarity.h in your project.
  2. Create a vector of strings or provide a list of strings.
  3. Initialize a CStringEmbeddings object with the vector of strings.
  4. Use the FindSimilarsFor method to find similar strings for a given input string.

Here's an example of how to use these classes:

#include "StringSimilarity.h"
#include <iostream>

int main() {
	std::vector<std::string> words = {
		"apple", "banana", "orange", "grape", "pineapple", "strawberry", "watermelon", "kiwi", "pear", "peach",
		"blueberry", "raspberry", "blackberry", "melon", "cherry", "apricot", "mango", "papaya", "plum", "lemon"
	};

	CStringEmbeddings embeddings(words);

	std::string wordToFindSimilarsFor = "apple";
	for (const auto& [similar, distance] : embeddings.FindSimilarsFor(wordToFindSimilarsFor)) {
		std::cout << "Similar: " << similar << ", Distance: " << distance << std::endl;
	}

	return 0;
}

License

GNU AGPLv3 Image

This program is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

stringsimilarity.cpp's People

Contributors

nir3x avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.