
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
K Anonymity for text (or in short - kanonym4text) is an open‑sourced library that receives a corpus from the user (dataframe) and returns a K-anonymized corpus with additional information about the anonymization process performed. kanon4txet is designed to be easily utilized, to guarantee anonymization at a certain level pre-defined by the user (k) while still preserving some of the text utilization properties. This repo and package are part of our Y-Data data science final project, and we would love to hear your feedback and learn from it!
In this project, we aim to apply data science techniques to anonymize textual data while preserving their utility. K-Anonymity is a technique used to ensure that an individual in a dataset cannot be identified by linking their attributes to external information, by forcing each row to be identical to k-1 other rows The anonymized data can be used for various purposes like data sharing, research, and analysis without compromising privacy. We plan on creating a novel algorithm for k-anonymity. Specifically, we address the case of unstructured data items, such as texts. Using various NLP techniques, from classical to modern DL-based solutions, and testing the utility of the anonymized data. We have tested the library on two main datasets:
We show it is able to generate anonymized corpora in both cases.
You can get started with kanonym4text immediately by installing it with pip:
pip install kanonym4text
The code receives a data frame containing the corpus in the following format: "txt" - column with the texts (default column name)
Use gensim word embedding model for you choice (default - glove-twitter-25)
from kanonym4text import Kanonym
kan = Kanonym()
import pandas as pd
df = pd.read_csv('YOUR_FILE.csv')
dfa, dist = kan.anonymize(df, k=2)
Running instructions: The main function is called anonymize.
df
- Input Dataframek
- kcol
- The column in df that holds the text to anonymize. Default - txtnum_stop
- Number of stop word to use. Default - 1000num_jobs
- Number of CPUs to utilize. Default - 1. All CPUs - -1.verbose
- Output text level. Default - 0.A tuple with these items:
- general_txt - text after "generalization"
- anon_txt_history - changes performed on text during annonymization process:
[] - replaced
{} - Lemmatize
() - protected word (stop-word)- anon_txt - resulted anonymized text
- neighbors - indeces of k neigbors (Bow anonymized)
use the following link to run some examples of the package on your own dataframe:
or use the following code:
from kanonym4text import Kanonym
import pandas as pd
df = pd.read_csv('YOUR_FILE.csv')
kan = Kanonym('glove-twitter-25') # creating an object from class
dfa, dist = kan.anonymize(df, k=k, n_jobs=-1, plot=True)
If you see an error message or run into an issue, please create a bug report. This effort is valued and helps all users.
If you have an idea, or you're missing a capability that would make development easier and more robust, please Submit a feature request.
If a similar feature request already exists, don't forget to leave a "+1". If you add some more information such as your thoughts and vision about the feature, your comments will be embraced warmly :)
Kanon4txt is an open-source project. We are committed to a fully transparent development process and highly appreciate any contributions. Whether you are helping us fix bugs, proposing new features, improving our documentation, or spreading the word - we would love to have you!
FAQs
k-anonymity for texts
We found that kanonym4text demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.