Skip to main content

A lightweight text processing library for pattern matching, similarity, classification and clustering

Project description

Hi I'm Ehsan Saeedi the creator of this library from Iran. for more details visit https://pixelai-net.ir/patternmind

and also here is a simple sample:

import patternmind as pm

models = []
inputs = ["how much is 5 plus 2","how much is 50 plus 20","how much is 500 plus 200"]
outputs = [" 5 + 2"," 50 + 20"," 500 + 200"]
model = pm.p_train(inputs,outputs)
models.append(model)
inputs = ["say 14","say iran","say ehsan saeedi"]
outputs = ["ok. 14","ok. iran","ok. ehsan saeedi"]
model = pm.p_train(inputs,outputs)
models.append(model)
prompts = ["say love is good","how much is 52 plus 91"]
for prompt in prompts:
	position = pm.p_find(models,prompt)
	try:
		print(eval(pm.p_result(prompt,models[position])["result"]))
	except:
		print(pm.p_result(prompt,models[position])["result"])

a1 = "i love iran"
a2 = "i hate iran"
print(pm.similarity(a1,a2)["percent"])

inputs = ["i hate you","i damn you","i kill you","i love you","i want you","i like you"]
outputs = ["-","-","-","+","+","+"]
model = pm.n_train(inputs,outputs)
prompt = "we love him"
print(pm.n_result(prompt,model)["tag"])

inputs = ["i love you","i love him","i hate it","i hate her"]
sim = 0.7
print(pm.partit(inputs,sim)["parts"])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patternmind-1.1.0.tar.gz (14.2 kB view details)

Uploaded Source

File details

Details for the file patternmind-1.1.0.tar.gz.

File metadata

  • Download URL: patternmind-1.1.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for patternmind-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7a5f4bde568d56c7f6bf239129c1e9e22ec3aaac981e990bbbe59058f4b25c51
MD5 b3ea4dc377bac105834306c96e3ce51d
BLAKE2b-256 2c66950d2e0b0531d5ef8ffda2db9ac89e45586af75760f5816a088346345d62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page