Giter VIP home page Giter VIP logo

dpcommonstrings's Introduction

Find ALL the common substrings among 2 strings

Features

  • Implemented in C++
  • Can be loaded as a module in Python3
  • Support UTF8!!!

The main purpose of creating this program was to have a faster alternative of difflib.get_matching_blocks function.

The involved algorithm of this program is exactly the same as that of difflib.get_matching_blocks, however, since this program is a native C++, while difflib is native Python, this program is much FASTER!

I'm pretty sure that this will be helpful especially if you want to find all the substrings, not just the longest, among huge strings.

Also, as a Japanese, I want to emphasize that this program support UTF8! For those who rely on UTF8 including Japanese, Chinese, Korean, etc., this is for you.

Usage & How to compile

Since this is C++ program, you need to first compile it. I have added Makefile to make this process easier. You can just type command "make" to compile it, hopefully. You may get some error depending on your environment, then you can report an issue or just edit the Makefile.

Once you compile this properly, you will have a library file name "*.so". You can import this from Python3 just like a normal module: "import ".

Sample Code (Assuming the generated module is named "findCommon.so")

import findCommon

string0 = 'Tokyo, Japan'
string1 = 'Yokohama, Japan'
min_length = 2

matches = findCommon.findCommon(string0, string1, min_length)

Requirement

To make the implementation of the interface between C++ and Python3 simpler, Boost.Python is used in this program. Therefore make sure that you have installed boost library in prior to the compilation, otherwise it will fail.

dpcommonstrings's People

Contributors

yoshihikoueno 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.