Web-based text anonymization with Node.js

Web-based text anonymization with Node.js: Introducing NETANOS (Named entity-based Text Anonymization for Open Science) - Published in JOSS (2017)

https://github.com/ben-aaron188/netanos

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 4 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software
Last synced: 6 months ago · JSON representation

Repository

NETANOS: Named entity-based Text Anonymization for Open Science'

Basic Info
Statistics
  • Stars: 10
  • Watchers: 2
  • Forks: 5
  • Open Issues: 1
  • Releases: 2
Created almost 9 years ago · Last pushed over 7 years ago
Metadata Files
Readme Contributing License Code of conduct

README.md

DOI

Summary

Netanos (Named Entity-based Text ANonymization for Open Science) is a natural language processing software that anonymizes texts by identifying and replacing named entities. The key feature of NETANOS is that the anonymization preserves critical context that allows for secondary linguistic analyses on anonymized texts.

Installation, usage, and dependencies

NETANOS requires Stanford's Named Entity Recognizer (Finkel, Grenager, & Manning, 2005). You can download the Java distribution here. Once you have it downloaded, the Stanford NER needs to be executed before NETANOS can be used. This can be done as follows (with Stanford NER running on port 8080):

  • go to the directory netanos/libs/stanford-ner/ and run the following command (in Terminal) after unzipping the downloaded Stanford NER file:

bash $ java -mx1000m -cp "stanford-ner.jar:lib/*" edu.stanford.nlp.ie.NERServer -loadClassifier classifiers/english.muc.7class.distsim.crf.ser.gz -port 8080 -outputFormat inlineXML

  • once you started the Java-Server, keep it running and navigate to the directory ./netanos to run your anonymization script with node run.js
  • after you've finished, you can end the server with crtl + c

Furthermore, NETANOS relies on the following node.js-dependencies:

  • ner (https://github.com/niksrc/ner)
  • promise (https://github.com/then/promise)

Installing NETANOS (after Stanford's NER is downloaded)

You can use npm install or compile NETANOS from source. For both installation types, make sure you've got the Node.js dependencies installed:

  • Install the Stanford NER Java distribution (see above for the exact command)
  • Open terminal and install the dependencies.

javascript npm install ner npm install promise

1. npm install

NETANOS can easily be installed via npm.

$ npm install netanos

The integration is illustrated below. The anonymization function takes the input string and a callback function as arguments and returns the anonymized string via the callback.

```javascript var netanos = require("netanos"); //note that this is different from the filepath in the from-source installation var input = "Max and Ben spent more than 1000 hours on writing the software. They started in August 2016 in Amsterdam.";

var entities = { person: true, organization: true, currency: true, date: true, location: true, pronoun: true, numeric: true, other: true };

netanos.ner(input, entities, function(output) { console.log(output); });

/* "Barry and Rick spent more than 997 hours on writing the software. They started in January 14 2016 in Odessa." */ ```

2. Compile from source

Alternatively, the NETANOS source-code can be integrated manually with the Netanos.js file as user endpoint.

  1. Access run.js to set the input of your string.

```javascript var netanos = require("./Netanos.js"); var input = "Max and Ben spent more than 1000 hours on writing the software. They started in August 2016 in Amsterdam.";

var entities = { person: true, organization: true, currency: true, date: true, location: true, pronoun: true, numeric: true, other: true };

netanos.ner(input, entities, function(output) { console.log(output); });

/* "Barry and Rick spent more than 997 hours on writing the software. They started in January 14 2016 in Odessa." */ ```

  1. In Terminal, run the run.js script:

node run.js

Tests with npm test

Once the Java server is running, you can test the functionality of NETANOS with npm test. To do this, make sure you've got the JavaScript test framework mocha.js installed (use npm install mocha).

The tests will run for all four core methods of NETANOS.

Documentation

NETANOS offers the following functionality:

  1. Context-preserving anonymization (netanos.anon): each identified entity is replaced with an indexed generic replacement of the entity type (e.g. Peter -> [PERSON1], Chicago -> [LOCATION\1]). The object entities allows you to specify the entities you would like to have included in your anonymization.

```javascript var input = "Max and Ben spent more than 1000 hours on writing the software. They started in August 2016 in Amsterdam.";

var entities = { person: true, organization: true, currency: true, date: true, location: true, pronoun: true, numeric: true, other: true };

netanos.anon(input, entities, function(output) { console.log(output); });

/* "[PERSON1] and [PERSON2] spent more than [DATE/TIME1] on writing the software. They started in [DATE/TIME2] in [LOCATION_1]." / ``` 2. *Named entity-based replacement** (netanos.ner): each identified entity will be replaced with a different entity of the same type (e.g. Peter -> Alfred, Chicago -> London). The object entities allows you to specify the entities you would like to have included in your anonymization.

```javascript var input = "Max and Ben spent more than 1000 hours on writing the software. They started in August 2016 in Amsterdam.";

var entities = { person: false, organization: true, currency: true, date: true, location: true, pronoun: true, numeric: true, other: true };

netanos.ner(input, entities, function(output) { console.log(output); });

/* “Max and Ben spent more than 997 hours on writing the software. They started in January 14 2016 in Odessa.” / ``` 3. *Non-context preserving anonymization** (netanos.noncontext): this approach is not based on named entities and replaces every word starting with a capital letter and every numeric value with "XXX". Note that entity-specific anonymization is not compatible with this type.

```javascript var input = "Max and Ben spent more than 1000 hours on writing the software. They started in August 2016 in Amsterdam.";

/* Note that the non-context preserving replacement is not asynchronous as it does not rely on the named entitiy recognition. */ var anonymized = netanos.noncontext(input);

console.log(anonymized);

/* “XXX and XXX spent more than XXX hours on writing the software. XXX started in XXX XXX in XXX.” / ``` 4. *Combined, non-context preserving anonymization** (netanos.combined): the non-context preserving replacement and the named entity-based replacement are combined such that each word starting with a capital letter, each numeric value and all identified named entities are replaced with "XXX". The object entities allows you to specify the entities you would like to have included in your anonymization.

```javascript var input = "Max and Ben spent more than 1000 hours on writing the software. They started in August 2016 in Amsterdam.";

var entities = { person: true, organization: true, currency: true, date: true, location: true, pronoun: true, numeric: true, other: true };

netanos.combined(input, entities, function(output) { console.log(output); });

/* “XXX and XXX spent more than XXX XXX on writing the software. XXX started in XXX XXX in XXX.” */ ```

Contact

projectnetanos@gmail.com

License

MIT © Bennett Kleinberg & Maximilian Mozes

Owner

  • Name: BKleinberg
  • Login: ben-aaron188
  • Kind: user

JOSS Publication

Web-based text anonymization with Node.js: Introducing NETANOS (Named entity-based Text Anonymization for Open Science)
Published
June 25, 2017
Volume 2, Issue 14, Page 293
Authors
Bennett Kleinberg ORCID
University of Amsterdam, The Netherlands
Maximilian Mozes ORCID
Technical University of Munich, Germany
Editor
Abigail Cabunoc Mayes ORCID
Tags
computational linguistics text anonymization open science named entity recognition

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 56
  • Total Committers: 4
  • Avg Commits per committer: 14.0
  • Development Distribution Score (DDS): 0.536
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
BKleinberg b****g@g****m 26
Maximilian Mozes m****n@m****e 17
maximilianmozes m****s@c****u 12
Arfon Smith a****n 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 7
  • Total pull requests: 3
  • Average time to close issues: 3 days
  • Average time to close pull requests: 10 days
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 1.14
  • Average comments per pull request: 2.67
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • RichardLitt (6)
  • tanay13 (1)
Pull Request Authors
  • maximilianmozes (2)
  • arfon (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • npm 9 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 7
  • Total maintainers: 2
npmjs.org: netanos

NETANOS: Named entity-based Text Anonymization for Open Science

  • License: MIT
  • Latest release: 1.1.5
    published over 8 years ago
  • Versions: 7
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 9 Last month
Rankings
Forks count: 7.9%
Stargazers count: 9.7%
Dependent repos count: 10.7%
Average: 13.9%
Downloads: 20.1%
Dependent packages count: 21.2%
Maintainers (2)
Last synced: 6 months ago