Skip to main content

nlpc

nlpc is a super fast c++ library which adopts dynamic programming(DP) algorithm to solve classic nlp problems as below .

The longest common subsequence problem is the problem of finding the longest subsequence common to all sequences in a set of sequences (often just two sequences).

The longest common substring problem is to find the longest string (or strings) that is a substring (or are substrings) of two or more strings.

We also support Chinese(or any UTF-8) string

Install

To install, simply do pip install nlpc to pull down the latest version from PyPI.

Python code example

import nlpc

#  finding the longest common subsequence length of string A and string B
A = 'We are shannonai'
B = 'We like shannonai'
nlpc.lcs(A, B)
"""
>>> nlpc.lcs(A, B)
14
"""

#  finding the longest common subsequence length of string A and a list of string B
A = 'We are shannonai'
B = ['We like shannonai', 'We work in shannonai', 'We are not shannonai']
nlpc.lcs_of_list(A, B)
"""
>>> nlpc.lcs_of_list(A, B)
[14, 14, 16]
"""

# finding the longest common substring length of string A and string B
A = 'We are shannonai'
B = 'We like shannonai'
nlpc.lcs2(A, B)
"""
>>> nlpc.lcs2(A, B)
11
"""

#  finding the longest common substring length of string A and a list of string B
A = 'We are shannonai'
B = ['We like shannonai', 'We work in shannonai', 'We are not shannonai']
nlpc.lcs2_of_list(A, B)
"""
>>> nlpc.lcs2_of_list(A, B)
[11, 10, 10]
"""

Release files for nlpc 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nlpc 0.0.1
File Size Uploaded
nlpc-0.0.1.tar.gz 3.8 kB Details

Release files / nlpc-0.0.1.tar.gz

Download URL nlpc-0.0.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
225b43a3da56e315e4cd7f6d514ccd9597b64b197d57b4bdc29c777a24158e9b
BLAKE2b-256 checksum
How to use checksums
5829046155a1d3d52058d526df9e9eb8c29413f9ae3b16ce54a26fd42fc0d6d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page