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.
Similator is a cutting-edge Python library that leverages the power of Rust to offer unparalleled speed and efficiency in text validation and comparison. By combining the ease of Python with the performance of Rust, Similator achieves up to 10x faster processing compared to traditional implementations. This fusion represents a significant leap forward in text processing technology.
Install Similator quickly and easily using pip:
pip install similator
Here's a quick example to get you up and running with Similator:
from similator import TextSimilator, ValidData
# Example data
valid_strings = ["Hello", "World", "Text", "Example", "Python"]
# Initialize ValidData
valid_data_instance = ValidData(valid_strings, encoding='utf-8')
# Initialize TextSimilator with ValidData
text_similator = TextSimilator(valid_data_instance, encoding='utf-8', case_sensitive=False)
Search for a string within the valid data with a similarity threshold:
search_value = "hello"
results = text_similator.search(search_value, threshold=0.85)
print(results)
# Output: [('hello', 2.0)]
Directly compare two strings to obtain a similarity score:
value1 = "hello"
value2 = "hell"
similarity_score = text_similator.compare(value1, value2)
print(similarity_score)
# Output: 1.94
If your application involves repeated searches with similar queries, you can enable caching to improve performance:
# Enable caching with a maximum size of 50 cached results
text_similator_with_cache = TextSimilator(valid_data_instance, auto_cached=True, max_cache_size=50)
# Perform a search and it will be cached
results_cached = text_similator_with_cache.search("python", threshold=0.9)
You can export the cache to a file and reload it later for persistent storage:
# Export the current cache to a JSON file
text_similator_with_cache.memory.export_memory("cache.json")
# Load the cache from a JSON file
text_similator_with_cache.memory.load_memory("cache.json")
If you have any questions, suggestions, or just want to say hello, feel free to contact me:
Contributions are welcome! If you have any ideas, suggestions, or issues, feel free to open an issue or submit a pull request.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
FAQs
A powerful text similarity module with Rust optimizations.
We found that similator 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.