You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

commonform-alex

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commonform-alex - npm Package Compare versions

Comparing version

to
0.3.0

15

data/excludes.json
[
"illegal"
"wife",
"husband",
"aunt",
"uncle",
"sister",
"brother",
"maternity",
"paternity",
"mother",
"father",
"daughter",
"son",
"masterpiece",
"insanity"
]

25

index.js

@@ -16,15 +16,12 @@ // Modules

// TODO: Exclude common legal words that aren't offensive (#1)
// Subtract phrases that are not offensive in legal context, e.g., "illegal"
// var excludes = require('./data/excludes.json');
// var with_exclusions = inconsiderates.filter(function(item) {
// // return !(item in excludes) ? true : false;
// if (!(item in excludes)) {
// return true;
// } else {
// console.log('- excluding ' + item);
// return false;
// }
// })
// console.log(with_exclusions.length);
// Subtract phrases that are not offensive in legal context
var excludes = require('./data/excludes.json');
var filter_func = function(item) {
if (excludes.indexOf(item) != -1 ) {
return false;
} else {
return true;
}
};
var with_exclusions = inconsiderates.filter(filter_func);

@@ -44,2 +41,2 @@ // TODO: Move above data wrangling steps into build script (#2)

// The End! Initialize and export our phrase annotator.
module.exports = phraseAnnotator(inconsiderates, annotator);
module.exports = phraseAnnotator(with_exclusions, annotator);
{
"name": "commonform-alex",
"version": "0.2.4",
"version": "0.3.0",
"description": "Critique Common Forms for insensitive language",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -41,2 +41,8 @@ # commonform-alex

// Exclusion test
assert.deepEqual(
annotator({ content: [ 'Talking about paternity is acceptable in family law cases, so we allow it.' ] }),
[ ] )
// Many test

@@ -43,0 +49,0 @@