Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Fast text processing acceleration. 一个快速的文本处理及NLP工具.
当前0.0.1测试版:
pip install py-bolt
from pybolt import bolt_text
bolt_text.add_keywords(["清华", "清华大学"])
found_words = bolt_text.extract_keywords("我收到了清华大学的录取通知书.")
print(found_words)
# ['清华', '清华大学']
found_words = bolt_text.extract_keywords("我收到了清华大学的录取通知书.", longest_only=True)
print(found_words)
# ['清华大学']
from pybolt import bolt_text
def get_lines():
yield "我考上了清华大学"
yield "我梦见我考上了清华大学"
bolt_text.add_keywords(["清华", "清华大学"])
for df in bolt_text.batch_extract_keywords(get_lines(), concurrency=10000000):
for _, row in df.iterrows():
print(row.example, row.keywords)
from pybolt import bolt_text
bolt_text.add_replace_map({"清华大学": "北京大学"})
sentence = bolt_text.replace_keywords("我收到了清华大学的录取通知书.")
print(sentence)
# "我收到了北京大学的录取通知书."
from pybolt import bolt_text
def get_lines():
yield "我考上了清华大学"
yield "我梦见我考上了清华大学"
bolt_text.add_replace_map({"清华大学": "北京大学"})
for df in bolt_text.batch_extract_keywords(get_lines(), concurrency=10000000):
for _, row in df.iterrows():
print(row.example)
from pybolt import bolt_text
bolt_text.add_co_occurrence_words(["小明", "清华"], "高考")
res, tag = bolt_text.is_co_occurrence("小明考上了清华大学")
print(res, tag)
# True 高考
from pybolt import bolt_text
def get_lines():
yield "小明考上了清华大学"
yield "小明做梦的时候考上了清华大学"
yield "大明做梦的时候考上了清华大学"
def my_processor(line):
if line.startswith("小明"):
return True
return None
for df in bolt_text.batch_text_processor(get_lines(), my_processor):
df = df[df["processor_result"].notna()]
print(df.head())
from pybolt import bolt_text
print(bolt_text.normalize("⓪⻆🈚"))
import re
from pybolt import bolt_text
_pattern = re.compile("([^\u4E00-\u9FD5\u9FA6-\u9FEF\u3400-\u4DB5a-zA-Z0-9 +]+)", re.U)
print(bolt_text.clean("aaaaa+++++.....abcadf ga a", pattern=_pattern, pattern_replace="", normalize=True, crc_cut=3))
from pybolt.bolt_nlp import WordDiscover
wd = WordDiscover()
wd.word_discover(["examples.txt"])
# will save the new_words.vocab in execution directory
FAQs
Fast text processing acceleration.
We found that py-bolt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.