diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d02e556..573c728 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ If you are having difficulties running the app or have a question about the serv # Issues -If you encounter an issue with this sample app, you are welcome to submit a [bug report](https://github.com/watson-developer-cloud/yourcelebritymatch/issues). Before that, please search for similar issues. It's possible somebody has encountered this issue already. +If you encounter an issue with this sample app, you are welcome to submit a [bug report](https://github.com/watson-developer-cloud/your-celebrity-match/issues). Before that, please search for similar issues. It's possible somebody has encountered this issue already. # Pull Requests diff --git a/README.md b/README.md index 21a4fe2..9df23bb 100755 --- a/README.md +++ b/README.md @@ -19,13 +19,11 @@ The application uses [The Personality Insights API](https://www.ibm.com/watson/d # How it works -Steps | -:------------: | -You input your Twitter handle
You input your Twitter handle.
| -Calls the Twitter API.
Calls the Twitter API to get the latest 2300 tweets from your public feed.
| -Calls the Personality Insights API.
Calls the Personality Insights API to analyze the language in your tweets and apply it to a spectrum of characteristics.
| -Compares your Personality Insights profile to 232 celebrity profiles analyzed with the service.
Compares your Personality Insights profile to 232 celebrity profiles analyzed with the service.
| -Sorts your matches and shows you the highest and lowest. These are calculated by the euclidean distance between the two.
Sorts your matches and shows you the highest and lowest. These are calculated by the euclidean distance between the two.
| + 1. You input your Twitter handle. + 1. Calls the Twitter API to get the latest 2300 tweets from your public feed. + 1. Calls the Personality Insights API to analyze the language in your tweets and apply it to a spectrum of characteristics. + 1. Compares your Personality Insights profile to 232 celebrity profiles analyzed with the service. + 1. Sorts your matches and shows you the highest and lowest. These are calculated by the euclidean distance between the two. ## Prerequisites @@ -45,31 +43,23 @@ Steps | This instructions will help you install the celebrities app in your local environment. 1. Clone the repository with: - ```sh $ git clone git@github.com:watson-developer-cloud/your-celebrity-match.git ``` - -1. Install [node][node] (use v0.10.31) - +1. Install [node][node] 1. Install [mongodb][mongodb] - 1. Install the npm modules: - ```sh $ npm install ``` **Note:** Make sure you are in the project directory, the `package.json` file should be visible. - 1. Start mongodb - ```sh $ mongod ``` (Run this in a separate terminal window) - -1. You need some credentials to use Twitter API, Personality Insights and MongoDC: - - Get credentials to use Personality Insights. +1. You need some credentials to use Twitter API, Personality Insights and MongoDB: + - Get credentials to use Personality Insights. - Create a **FREE** Mongodb database using [MongoLab](https://mlab.com/). - Create a Twitter app and get the API credentials [here][twitter_app]. 1. Update the Twitter, MongoDB and Personality Insights credentials in `config/config.js` @@ -79,11 +69,9 @@ This instructions will help you install the celebrities app in your local enviro { personality_insights: { + version: '2017-10-13', url: '', - username: '', - password: '' - // If your credentials have an apikey field use - // iam_apikey: '', + iam_apikey: ''s }, twitter: [{ @@ -102,7 +90,6 @@ This instructions will help you install the celebrities app in your local enviro ``` 1. Update the database with the celebrities by making a **POST** request to: - `http://localhost:3000/celebrities/syncdb` The celebrities are not added by default. Hence the above step is recommended. Refer #Celebrities section below for more information. @@ -116,7 +103,7 @@ This instructions will help you install the celebrities app in your local enviro ## Celebrities - The application comes with two 'celebrity' profiles: [@germanatt][german_twitter] and [@nfriedly][nathan_twitter]. If you want to add more profiles, you have two options: + The application comes with 1 'celebrity' profile: [@germanatt][german_twitter]. If you want to add more profiles, you have two options: ### Auto-Lookup 1. Choose a person on Twitter to include as a 'celebrity'. Ensure this person is verified, has at least 10,000 followers, and has over 1,000 tweets. @@ -146,10 +133,9 @@ This instructions will help you install the celebrities app in your local enviro Find more open source projects on the [IBM Github Page](http://ibm.github.io/) [bluemix]: https://console.ng.bluemix.net/ -[node]: http://nodejs.org/download +[node]: http://nodejs.org/ [mongodb]: http://docs.mongodb.org/manual/installation/ [twitter_app]: https://apps.twitter.com/app/new [german_twitter]: https://twitter.com/germanatt -[nathan_twitter]: https://twitter.com/nfriedly [pi_docs]: https://console.bluemix.net/docs/services/personality-insights/index.html [vcap_environment]: https://console.bluemix.net/docs/services/watson/getting-started-variables.html diff --git a/app/routes/user.js b/app/routes/user.js index 38c2c8f..f94af38 100755 --- a/app/routes/user.js +++ b/app/routes/user.js @@ -30,9 +30,9 @@ var celebs =[]; var getCelebrityFromDB = Q.denodeify(Profile.find.bind(Profile)); // Constants for types of profiles -var PERSONALITY = 0, - NEEDS = 1, - VALUES = 2; +var PERSONALITY = 'personality', + NEEDS = 'needs', + VALUES = 'values'; /** * Updates an array with the celebrity profile pictures. diff --git a/app/util/flatten.js b/app/util/flatten.js index 5c466d9..a25b6bc 100755 --- a/app/util/flatten.js +++ b/app/util/flatten.js @@ -23,11 +23,11 @@ */ var traits = function(tree, type) { var profile = typeof(tree) === 'string' ? JSON.parse(tree) : tree; - var _traits = profile.tree.children[type].children[0].children; + var _traits = profile[type]; return _traits.map(function(trait) { return { name: trait.name, - value: trait.percentage + value: trait.percentile }; }); }; diff --git a/app/util/similarity.js b/app/util/similarity.js index 1ce6dbe..f042481 100755 --- a/app/util/similarity.js +++ b/app/util/similarity.js @@ -26,12 +26,12 @@ var similarity = function( /*object*/ origin, /*object*/ target, type) { origin = typeof(origin) === 'string' ? JSON.parse(origin) : origin; target = typeof(target) === 'string' ? JSON.parse(target) : target; var distance = 0.0, - origin_traits = origin.tree.children[type].children[0].children, - target_traits = target.tree.children[type].children[0].children; + origin_traits = origin[type], + target_traits = target[type]; // for each trait in origin personality... origin_traits.forEach(function(trait, i) { - distance += Math.pow(trait.percentage - target_traits[i].percentage, 2); + distance += Math.pow(trait.percentile - target_traits[i].percentile, 2); }); var ret = 1 - (Math.sqrt(distance / origin_traits.length)); return ret; diff --git a/app/util/util.js b/app/util/util.js index 58d67ae..616e8e5 100755 --- a/app/util/util.js +++ b/app/util/util.js @@ -33,8 +33,6 @@ module.exports = { toContentItem : function(tweet) { return { id: tweet.id_str, - userid: tweet.user.id_str, - sourceid: 'twitter', language: (tweet.lang && (['es','en'].indexOf(tweet.lang) > -1)) ? tweet.lang : 'en', contenttype: 'text/plain', content: tweet.text.replace('[^(\\x20-\\x7F)]*',''), diff --git a/app/views/index.jade b/app/views/index.jade index 574f9ef..4c9cd79 100755 --- a/app/views/index.jade +++ b/app/views/index.jade @@ -42,7 +42,7 @@ block content .row.extra-links .col-md-12 p.text-center - a(href='https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/') Built with IBM Watson + a(href='https://www.ibm.com/watson/developer/') Built with IBM Watson .row.extra-links .col-md-12 p.text-center diff --git a/config/config.js b/config/config.js index 9964123..f881743 100755 --- a/config/config.js +++ b/config/config.js @@ -22,7 +22,7 @@ module.exports = { // Personality Insights credentials personality_insights: { - version: 'v3' + version: '2017-10-13' }, // Twitter app credentials: https://apps.twitter.com/app diff --git a/config/security.js b/config/security.js index 9e5f38e..99041a8 100644 --- a/config/security.js +++ b/config/security.js @@ -30,8 +30,6 @@ module.exports = function (app) { // 2. helmet with defaults app.use(helmet({ cacheControl: false })); - app.use(helmet.frameguard('allow-from', 'https://ibm-sxsw.mybluemix.net')); - // 3. rate-limit to /api/ app.use('/like/', rateLimit({ windowMs: 30 * 1000, // seconds diff --git a/package-lock.json b/package-lock.json index f781789..42fc485 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "@types/tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha512-MDQLxNFRLasqS4UlkWMSACMKeSm1x4Q3TxzUC7KQUsh6RK1ZrQ0VEyE3yzXcBu+K8ejVj4wuX32eUG02yNp+YQ==" + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-Set5ZdrAaKI/qHdFlVMgm/GsAv/wkXhSTuZFkJ+JI7HK+wIkIlOaUXSXieIvJ0+OvGIqtREFoE+NHJtEq0gtEw==" }, "accepts": { "version": "1.3.5", @@ -74,21 +74,6 @@ "requires": { "mime-types": "~2.1.18", "negotiator": "0.6.1" - }, - "dependencies": { - "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" - }, - "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "requires": { - "mime-db": "~1.33.0" - } - } } }, "ajv": { @@ -437,7 +422,7 @@ }, "csv-stringify": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-1.0.4.tgz", + "resolved": "http://registry.npmjs.org/csv-stringify/-/csv-stringify-1.0.4.tgz", "integrity": "sha1-vBi6ua1M7zGV/SV5gLWLR5xC0+U=", "requires": { "lodash.get": "^4.0.0" @@ -580,9 +565,9 @@ "integrity": "sha1-WTKJDcn04vGeXrAqIAJuXl78j1g=" }, "dotenv": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.0.0.tgz", - "integrity": "sha512-FlWbnhgjtwD+uNLUGHbMykMOYQaTivdHEmYwAKFjn6GKe/CqY0fNae93ZHTd20snh9ZLr8mTzIL9m0APQ1pjQg==" + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.1.0.tgz", + "integrity": "sha512-/veDn2ztgRlB7gKmE3i9f6CmDIyXAy6d5nBq+whO9SLX+Zs1sXEgFLPi+aSuWqUuusMfbi84fT8j34fs1HaYUw==" }, "ecc-jsbn": { "version": "0.1.2", @@ -651,13 +636,13 @@ "integrity": "sha512-ngXzTfoRGG7fYens3/RMb6yYoVLvLMfmsSllP/mZPxNHgFq41TmPSLF/nLY7fwoclI2vElvAmILFWGUYqdjfCg==" }, "express": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", "requires": { "accepts": "~1.3.5", "array-flatten": "1.1.1", - "body-parser": "1.18.2", + "body-parser": "1.18.3", "content-disposition": "0.5.2", "content-type": "~1.0.4", "cookie": "0.3.1", @@ -674,10 +659,10 @@ "on-finished": "~2.3.0", "parseurl": "~1.3.2", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", + "safe-buffer": "5.1.2", "send": "0.16.2", "serve-static": "1.13.2", "setprototypeof": "1.1.0", @@ -687,71 +672,10 @@ "vary": "~1.1.2" }, "dependencies": { - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - } - } + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "statuses": { "version": "1.4.0", @@ -761,9 +685,9 @@ } }, "express-rate-limit": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-3.2.0.tgz", - "integrity": "sha512-oJpdtmt+mJivUCS9TVnlDAh/otWno4AaKz2cZkhbfpBna4CXB/pQjyUfWv2G7/09T3HqOIvB/93kU+eSmbeeTw==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-3.3.2.tgz", + "integrity": "sha512-JZnnTf6ZX9ntQalCZiPHsOG9zhxyRGqfaur+WD4yIcdqzf5FJQao5dmxXbWHk093K8WRSYwNwnzkFXVYnBNudg==", "requires": { "defaults": "^1.0.3" } @@ -823,6 +747,11 @@ "pend": "~1.2.0" } }, + "feature-policy": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/feature-policy/-/feature-policy-0.2.0.tgz", + "integrity": "sha512-2hGrlv6efG4hscYVZeaYjpzpT6I2OZgYqE2yDUzeAcKj2D1SH0AsEzqJNXzdoglEddcIXQQYop3lD97XpG75Jw==" + }, "file-type": { "version": "7.7.1", "resolved": "https://registry.npmjs.org/file-type/-/file-type-7.7.1.tgz", @@ -830,7 +759,7 @@ }, "finalhandler": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "requires": { "debug": "2.6.9", @@ -1019,13 +948,14 @@ "dev": true }, "helmet": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/helmet/-/helmet-3.13.0.tgz", - "integrity": "sha512-rCYnlbOBkeP6fCo4sXZNu91vIAWlbVgolwnUANtnzPANRf2kJZ2a6yjRnCqG23Tyl2/ExvJ8bDg4xUdNCIWnrw==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-3.15.0.tgz", + "integrity": "sha512-j9JjtAnWJj09lqe/PEICrhuDaX30TeokXJ9tW6ZPhVH0+LMoihDeJ58CdWeTGzM66p6EiIODmgAaWfdeIWI4Gg==", "requires": { "dns-prefetch-control": "0.1.0", "dont-sniff-mimetype": "1.0.0", "expect-ct": "0.1.1", + "feature-policy": "0.2.0", "frameguard": "3.0.0", "helmet-crossdomain": "0.3.0", "helmet-csp": "2.7.1", @@ -1151,9 +1081,9 @@ "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" }, "ipaddr.js": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", - "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" }, "is-extendable": { "version": "1.0.1", @@ -2423,13 +2353,13 @@ "integrity": "sha1-ICtIAhoMTL3i34DeFaF0Q8i0OYA=" }, "nock": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/nock/-/nock-10.0.0.tgz", - "integrity": "sha512-hE0O9Uhrg7uOpAqnA6ZfnvCS/TZy0HJgMslJ829E7ZuRytcS86/LllupHDD6Tl8fFKQ24kWe1ikX3MCrKkwaaQ==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/nock/-/nock-10.0.2.tgz", + "integrity": "sha512-uWrdlRzG28SXM5yqYsUHfYBRqljF8P6aTRDh6Y5kTgs/Q4GB59QWlpiegmDHQouvmX/rDyKkC/nk+k4nA+QPNw==", "dev": true, "requires": { "chai": "^4.1.2", - "debug": "^3.1.0", + "debug": "^4.1.0", "deep-equal": "^1.0.0", "json-stringify-safe": "^5.0.1", "lodash": "^4.17.5", @@ -2440,9 +2370,9 @@ }, "dependencies": { "debug": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", - "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", "dev": true, "requires": { "ms": "^2.1.1" @@ -2599,12 +2529,12 @@ "dev": true }, "proxy-addr": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", - "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", "requires": { "forwarded": "~0.1.2", - "ipaddr.js": "1.6.0" + "ipaddr.js": "1.8.0" } }, "psl": { @@ -3124,9 +3054,9 @@ } }, "watson-developer-cloud": { - "version": "3.11.1", - "resolved": "https://registry.npmjs.org/watson-developer-cloud/-/watson-developer-cloud-3.11.1.tgz", - "integrity": "sha512-Q6hMmlyJiXYMPFQ2FOIdWsX6RU1i4qh059JVXhiX1ly8n/OzL0d1yA5Vc2+FJP8HZr6StXqX2C7Wt/DNLc1Znw==", + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/watson-developer-cloud/-/watson-developer-cloud-3.13.0.tgz", + "integrity": "sha512-nmpiQN5QnwpBapmCCKxcChUBy0KzQ6tLCwTYskRYvCTUbZwN/LMWo0Uw1lV6vcp/QlE2BcfE0k7sbR5sd7GuMw==", "requires": { "@types/csv-stringify": "~1.4.2", "@types/extend": "~3.0.0", diff --git a/package.json b/package.json index 26d7a54..f8381a8 100644 --- a/package.json +++ b/package.json @@ -11,24 +11,24 @@ }, "dependencies": { "body-parser": "^1.18.3", - "dotenv": "^6.0.0", - "express": "^4.16.3", - "express-rate-limit": "^3.2.0", + "dotenv": "^6.1.0", + "express": "^4.16.4", + "express-rate-limit": "^3.3.2", "express-secure-only": "^0.2.1", "extend": "^3.0.2", - "helmet": "^3.13.0", + "helmet": "^3.15.0", "jade": "^1.11.0", "mongoose": "^4.13.17", "q": "^2.0.3", "twitter": "^0.2.13", - "watson-developer-cloud": "^3.11.1" + "watson-developer-cloud": "^3.13.0" }, "devDependencies": { "codecov": "^3.1.0", "istanbul": "^0.4.5", "jshint": "^2.9.6", "mocha": "^5.2.0", - "nock": "^10.0.0", + "nock": "^10.0.2", "supertest": "^3.3.0" }, "author": "IBM Corp.", diff --git a/profiles/1139651.json b/profiles/1139651.json deleted file mode 100644 index a021d57..0000000 --- a/profiles/1139651.json +++ /dev/null @@ -1,643 +0,0 @@ -{ - "tree": { - "id": "r", - "name": "root", - "children": [ - { - "id": "personality", - "name": "Big 5 ", - "children": [ - { - "id": "Extraversion_parent", - "name": "Extraversion", - "category": "personality", - "percentage": 0.12743791500190757, - "children": [ - { - "id": "Openness", - "name": "Openness", - "category": "personality", - "percentage": 0.6630108817114223, - "children": [ - { - "id": "Adventurousness", - "name": "Adventurousness", - "category": "personality", - "percentage": 0.5881046725802286, - "sampling_accuracy": 0.072432384 - }, - { - "id": "Artistic interests", - "name": "Artistic interests", - "category": "personality", - "percentage": 0.32527067086334094, - "sampling_accuracy": 0.13210048 - }, - { - "id": "Emotionality", - "name": "Emotionality", - "category": "personality", - "percentage": 0.3605335878610394, - "sampling_accuracy": 0.07728576 - }, - { - "id": "Imagination", - "name": "Imagination", - "category": "personality", - "percentage": 0.5059207567529572, - "sampling_accuracy": 0.099985344 - }, - { - "id": "Intellect", - "name": "Intellect", - "category": "personality", - "percentage": 0.6189858398551453, - "sampling_accuracy": 0.092952064 - }, - { - "id": "Liberalism", - "name": "Authority-challenging", - "category": "personality", - "percentage": 0.7921601271657881, - "sampling_accuracy": 0.11666448 - } - ], - "sampling_accuracy": 0.091281344 - }, - { - "id": "Conscientiousness", - "name": "Conscientiousness", - "category": "personality", - "percentage": 0.7163179171270065, - "children": [ - { - "id": "Achievement striving", - "name": "Achievement striving", - "category": "personality", - "percentage": 0.7103756808281416, - "sampling_accuracy": 0.08249951999999999 - }, - { - "id": "Cautiousness", - "name": "Cautiousness", - "category": "personality", - "percentage": 0.7934797330195659, - "sampling_accuracy": 0.10402 - }, - { - "id": "Dutifulness", - "name": "Dutifulness", - "category": "personality", - "percentage": 0.6090000339755115, - "sampling_accuracy": 0.13551596800000001 - }, - { - "id": "Orderliness", - "name": "Orderliness", - "category": "personality", - "percentage": 0.705300475459405, - "sampling_accuracy": 0.09638751999999999 - }, - { - "id": "Self-discipline", - "name": "Self-discipline", - "category": "personality", - "percentage": 0.5947086157073146, - "sampling_accuracy": 0.108175968 - }, - { - "id": "Self-efficacy", - "name": "Self-efficacy", - "category": "personality", - "percentage": 0.6792600456104311, - "sampling_accuracy": 0.105729792 - } - ], - "sampling_accuracy": 0.094079104 - }, - { - "id": "Extraversion", - "name": "Extraversion", - "category": "personality", - "percentage": 0.12743791500190757, - "children": [ - { - "id": "Activity level", - "name": "Activity level", - "category": "personality", - "percentage": 0.6825537359912647, - "sampling_accuracy": 0.147472864 - }, - { - "id": "Assertiveness", - "name": "Assertiveness", - "category": "personality", - "percentage": 0.22756925972197117, - "sampling_accuracy": 0.14085696 - }, - { - "id": "Cheerfulness", - "name": "Cheerfulness", - "category": "personality", - "percentage": 0.19960372599987106, - "sampling_accuracy": 0.11437648 - }, - { - "id": "Excitement-seeking", - "name": "Excitement-seeking", - "category": "personality", - "percentage": 0.142806740288766, - "sampling_accuracy": 0.11413775999999999 - }, - { - "id": "Friendliness", - "name": "Outgoing", - "category": "personality", - "percentage": 0.17768999697099241, - "sampling_accuracy": 0.106088032 - }, - { - "id": "Gregariousness", - "name": "Gregariousness", - "category": "personality", - "percentage": 0.12233906463403356, - "sampling_accuracy": 0.133278656 - } - ], - "sampling_accuracy": 0.127292896 - }, - { - "id": "Agreeableness", - "name": "Agreeableness", - "category": "personality", - "percentage": 0.37253765421489166, - "children": [ - { - "id": "Altruism", - "name": "Altruism", - "category": "personality", - "percentage": 0.3241057007611675, - "sampling_accuracy": 0.126164 - }, - { - "id": "Cooperation", - "name": "Cooperation", - "category": "personality", - "percentage": 0.7357032645974838, - "sampling_accuracy": 0.124722624 - }, - { - "id": "Modesty", - "name": "Modesty", - "category": "personality", - "percentage": 0.5370729332553797, - "sampling_accuracy": 0.136880448 - }, - { - "id": "Morality", - "name": "Uncompromising", - "category": "personality", - "percentage": 0.653217863051545, - "sampling_accuracy": 0.12032928 - }, - { - "id": "Sympathy", - "name": "Sympathy", - "category": "personality", - "percentage": 0.698280017781633, - "sampling_accuracy": 0.13425868800000001 - }, - { - "id": "Trust", - "name": "Trust", - "category": "personality", - "percentage": 0.6871487117770918, - "sampling_accuracy": 0.132978656 - } - ], - "sampling_accuracy": 0.117622624 - }, - { - "id": "Neuroticism", - "name": "Emotional range", - "category": "personality", - "percentage": 0.5425864011386774, - "children": [ - { - "id": "Anger", - "name": "Fiery", - "category": "personality", - "percentage": 0.47210365972321655, - "sampling_accuracy": 0.06796527999999999 - }, - { - "id": "Anxiety", - "name": "Prone to worry", - "category": "personality", - "percentage": 0.4368076063664088, - "sampling_accuracy": 0.07546844800000001 - }, - { - "id": "Depression", - "name": "Melancholy", - "category": "personality", - "percentage": 0.3299512995237408, - "sampling_accuracy": 0.092570688 - }, - { - "id": "Immoderation", - "name": "Immoderation", - "category": "personality", - "percentage": 0.5007152791667417, - "sampling_accuracy": 0.072158656 - }, - { - "id": "Self-consciousness", - "name": "Self-consciousness", - "category": "personality", - "percentage": 0.558117794088483, - "sampling_accuracy": 0.113088096 - }, - { - "id": "Vulnerability", - "name": "Susceptible to stress", - "category": "personality", - "percentage": 0.590391324790456, - "sampling_accuracy": 0.07445904 - } - ], - "sampling_accuracy": 0.065439104 - } - ] - } - ] - }, - { - "id": "needs", - "name": "Needs", - "children": [ - { - "id": "Structure_parent", - "name": "Structure", - "category": "needs", - "percentage": 0.1546529897936773, - "children": [ - { - "id": "Challenge", - "name": "Challenge", - "category": "needs", - "percentage": 0.4840824329502694, - "sampling_accuracy": 0.409484832 - }, - { - "id": "Closeness", - "name": "Closeness", - "category": "needs", - "percentage": 0.5321203638568756, - "sampling_accuracy": 0.472659936 - }, - { - "id": "Curiosity", - "name": "Curiosity", - "category": "needs", - "percentage": 0.6889149854901133, - "sampling_accuracy": 0.420224832 - }, - { - "id": "Excitement", - "name": "Excitement", - "category": "needs", - "percentage": 0.6068963779135879, - "sampling_accuracy": 0.439620736 - }, - { - "id": "Harmony", - "name": "Harmony", - "category": "needs", - "percentage": 0.8202855370514788, - "sampling_accuracy": 0.48158784 - }, - { - "id": "Ideal", - "name": "Ideal", - "category": "needs", - "percentage": 0.5999144504522401, - "sampling_accuracy": 0.402577344 - }, - { - "id": "Liberty", - "name": "Liberty", - "category": "needs", - "percentage": 0.37799928020776563, - "sampling_accuracy": 0.38677903999999996 - }, - { - "id": "Love", - "name": "Love", - "category": "needs", - "percentage": 0.6936783503398546, - "sampling_accuracy": 0.49270105599999997 - }, - { - "id": "Practicality", - "name": "Practicality", - "category": "needs", - "percentage": 0.5808143167981163, - "sampling_accuracy": 0.468810208 - }, - { - "id": "Self-expression", - "name": "Self-expression", - "category": "needs", - "percentage": 0.8153678203439297, - "sampling_accuracy": 0.470467648 - }, - { - "id": "Stability", - "name": "Stability", - "category": "needs", - "percentage": 0.40203292727808515, - "sampling_accuracy": 0.490218912 - }, - { - "id": "Structure", - "name": "Structure", - "category": "needs", - "percentage": 0.1546529897936773, - "sampling_accuracy": 0.013119104000000001 - } - ] - } - ] - }, - { - "id": "values", - "name": "Values", - "children": [ - { - "id": "Self-transcendence_parent", - "name": "Self-transcendence", - "category": "values", - "percentage": 0.23942673156658514, - "children": [ - { - "id": "Conservation", - "name": "Conservation", - "category": "values", - "percentage": 0.5141237290141323, - "sampling_accuracy": 0.155100352 - }, - { - "id": "Openness to change", - "name": "Openness to change", - "category": "values", - "percentage": 0.42563911100757257, - "sampling_accuracy": 0.166714144 - }, - { - "id": "Hedonism", - "name": "Hedonism", - "category": "values", - "percentage": 0.3345831639263478, - "sampling_accuracy": 0.17007344 - }, - { - "id": "Self-enhancement", - "name": "Self-enhancement", - "category": "values", - "percentage": 0.6425748820318659, - "sampling_accuracy": 0.130272832 - }, - { - "id": "Self-transcendence", - "name": "Self-transcendence", - "category": "values", - "percentage": 0.23942673156658514, - "sampling_accuracy": 0.143632448 - } - ] - } - ] - }, - { - "id": "sbh", - "name": "", - "category": "sbr", - "children": [ - { - "id": "sbh_dom", - "name": "Fri. twitter", - "category": "sbr", - "children": [ - { - "id": "Friday_parent", - "name": "Fri. twitter", - "category": "behavior", - "percentage": 0.2120051085568327, - "children": [ - { - "id": "Sunday", - "name": "Sunday", - "category": "behavior", - "percentage": 0.09323116219667944 - }, - { - "id": "Monday", - "name": "Monday", - "category": "behavior", - "percentage": 0.12388250319284802 - }, - { - "id": "Tuesday", - "name": "Tuesday", - "category": "behavior", - "percentage": 0.15197956577266922 - }, - { - "id": "Wednesday", - "name": "Wednesday", - "category": "behavior", - "percentage": 0.1558109833971903 - }, - { - "id": "Thursday", - "name": "Thursday", - "category": "behavior", - "percentage": 0.1685823754789272 - }, - { - "id": "Friday", - "name": "Friday", - "category": "behavior", - "percentage": 0.2120051085568327 - }, - { - "id": "Saturday", - "name": "Saturday", - "category": "behavior", - "percentage": 0.09450830140485313 - } - ] - }, - { - "id": "2:00 am_parent", - "name": " twitter", - "category": "behavior", - "percentage": 0.0842911877394636, - "children": [ - { - "id": "0:00 am", - "name": "0:00 am", - "category": "behavior", - "percentage": 0.04853128991060025 - }, - { - "id": "1:00 am", - "name": "1:00 am", - "category": "behavior", - "percentage": 0.05874840357598978 - }, - { - "id": "2:00 am", - "name": "2:00 am", - "category": "behavior", - "percentage": 0.0842911877394636 - }, - { - "id": "3:00 am", - "name": "3:00 am", - "category": "behavior", - "percentage": 0.04469987228607918 - }, - { - "id": "4:00 am", - "name": "4:00 am", - "category": "behavior", - "percentage": 0.038314176245210725 - }, - { - "id": "5:00 am", - "name": "5:00 am", - "category": "behavior", - "percentage": 0.03065134099616858 - }, - { - "id": "6:00 am", - "name": "6:00 am", - "category": "behavior", - "percentage": 0.011494252873563218 - }, - { - "id": "7:00 am", - "name": "7:00 am", - "category": "behavior", - "percentage": 0.0038314176245210726 - }, - { - "id": "8:00 am", - "name": "8:00 am", - "category": "behavior", - "percentage": 0 - }, - { - "id": "9:00 am", - "name": "9:00 am", - "category": "behavior", - "percentage": 0.002554278416347382 - }, - { - "id": "10:00 am", - "name": "10:00 am", - "category": "behavior", - "percentage": 0 - }, - { - "id": "11:00 am", - "name": "11:00 am", - "category": "behavior", - "percentage": 0 - }, - { - "id": "12:00 pm", - "name": "12:00 pm", - "category": "behavior", - "percentage": 0.007662835249042145 - }, - { - "id": "1:00 pm", - "name": "1:00 pm", - "category": "behavior", - "percentage": 0.04469987228607918 - }, - { - "id": "2:00 pm", - "name": "2:00 pm", - "category": "behavior", - "percentage": 0.04980842911877394 - }, - { - "id": "3:00 pm", - "name": "3:00 pm", - "category": "behavior", - "percentage": 0.05108556832694764 - }, - { - "id": "4:00 pm", - "name": "4:00 pm", - "category": "behavior", - "percentage": 0.06513409961685823 - }, - { - "id": "5:00 pm", - "name": "5:00 pm", - "category": "behavior", - "percentage": 0.06130268199233716 - }, - { - "id": "6:00 pm", - "name": "6:00 pm", - "category": "behavior", - "percentage": 0.070242656449553 - }, - { - "id": "7:00 pm", - "name": "7:00 pm", - "category": "behavior", - "percentage": 0.07407407407407407 - }, - { - "id": "8:00 pm", - "name": "8:00 pm", - "category": "behavior", - "percentage": 0.07918263090676884 - }, - { - "id": "9:00 pm", - "name": "9:00 pm", - "category": "behavior", - "percentage": 0.04725415070242656 - }, - { - "id": "10:00 pm", - "name": "10:00 pm", - "category": "behavior", - "percentage": 0.06896551724137931 - }, - { - "id": "11:00 pm", - "name": "11:00 pm", - "category": "behavior", - "percentage": 0.05747126436781609 - } - ] - } - ] - } - ] - } - ] - }, - "id": "1139651", - "source": "twitter", - "word_count": 11322 -} \ No newline at end of file diff --git a/profiles/14578997.json b/profiles/14578997.json index 1d0fe94..8bb60a1 100644 --- a/profiles/14578997.json +++ b/profiles/14578997.json @@ -1,643 +1,833 @@ { - "tree": { - "id": "r", - "name": "root", - "children": [ - { - "id": "personality", - "name": "Big 5", - "children": [ - { - "id": "Openness_parent", - "name": "Openness", - "category": "personality", - "percentage": 0.844583038504123, - "children": [ - { - "id": "Openness", - "name": "Openness", - "category": "personality", - "percentage": 0.844583038504123, - "children": [ - { - "id": "Adventurousness", - "name": "Adventurousness", - "category": "personality", - "percentage": 0.7877939394998604, - "sampling_accuracy": 0.114843632 - }, - { - "id": "Artistic interests", - "name": "Artistic interests", - "category": "personality", - "percentage": 0.7121176932520873, - "sampling_accuracy": 0.2147532 - }, - { - "id": "Emotionality", - "name": "Emotionality", - "category": "personality", - "percentage": 0.19330306057237343, - "sampling_accuracy": 0.123156416 - }, - { - "id": "Imagination", - "name": "Imagination", - "category": "personality", - "percentage": 0.8522890101272751, - "sampling_accuracy": 0.154300096 - }, - { - "id": "Intellect", - "name": "Intellect", - "category": "personality", - "percentage": 0.8013220285873763, - "sampling_accuracy": 0.136418208 - }, - { - "id": "Liberalism", - "name": "Liberalism", - "category": "personality", - "percentage": 0.8179994821412124, - "sampling_accuracy": 0.177008464 - } - ], - "sampling_accuracy": 0.139926992 - }, - { - "id": "Conscientiousness", - "name": "Conscientiousness", - "category": "personality", - "percentage": 0.7380133988261607, - "children": [ - { - "id": "Achievement striving", - "name": "Achievement striving", - "category": "personality", - "percentage": 0.8504415073174355, - "sampling_accuracy": 0.146857104 - }, - { - "id": "Cautiousness", - "name": "Cautiousness", - "category": "personality", - "percentage": 0.7546269625652453, - "sampling_accuracy": 0.171513888 - }, - { - "id": "Dutifulness", - "name": "Dutifulness", - "category": "personality", - "percentage": 0.4863886923825753, - "sampling_accuracy": 0.2173252 - }, - { - "id": "Orderliness", - "name": "Orderliness", - "category": "personality", - "percentage": 0.2646778562213997, - "sampling_accuracy": 0.14150584 - }, - { - "id": "Self-discipline", - "name": "Self-discipline", - "category": "personality", - "percentage": 0.7286056080591397, - "sampling_accuracy": 0.176161152 - }, - { - "id": "Self-efficacy", - "name": "Self-efficacy", - "category": "personality", - "percentage": 0.7091830883140847, - "sampling_accuracy": 0.18777136 - } - ], - "sampling_accuracy": 0.161069104 - }, - { - "id": "Extraversion", - "name": "Extraversion", - "category": "personality", - "percentage": 0.15675196788019918, - "children": [ - { - "id": "Activity level", - "name": "Activity level", - "category": "personality", - "percentage": 0.7952673452461981, - "sampling_accuracy": 0.22689536 - }, - { - "id": "Assertiveness", - "name": "Assertiveness", - "category": "personality", - "percentage": 0.2371160303409563, - "sampling_accuracy": 0.21844552 - }, - { - "id": "Cheerfulness", - "name": "Cheerfulness", - "category": "personality", - "percentage": 0.16132016643322175, - "sampling_accuracy": 0.16978336 - }, - { - "id": "Excitement-seeking", - "name": "Excitement-seeking", - "category": "personality", - "percentage": 0.1675212038359129, - "sampling_accuracy": 0.17008552 - }, - { - "id": "Friendliness", - "name": "Friendliness", - "category": "personality", - "percentage": 0.1686095361572544, - "sampling_accuracy": 0.182659408 - }, - { - "id": "Gregariousness", - "name": "Gregariousness", - "category": "personality", - "percentage": 0.23994167296832658, - "sampling_accuracy": 0.20223899199999998 - } - ], - "sampling_accuracy": 0.190136832 - }, - { - "id": "Agreeableness", - "name": "Agreeableness", - "category": "personality", - "percentage": 0.1758571417856013, - "children": [ - { - "id": "Altruism", - "name": "Altruism", - "category": "personality", - "percentage": 0.37162178385980743, - "sampling_accuracy": 0.21419504 - }, - { - "id": "Cooperation", - "name": "Cooperation", - "category": "personality", - "percentage": 0.4891482659109937, - "sampling_accuracy": 0.201434944 - }, - { - "id": "Modesty", - "name": "Modesty", - "category": "personality", - "percentage": 0.2268726803846479, - "sampling_accuracy": 0.20362584 - }, - { - "id": "Morality", - "name": "Morality", - "category": "personality", - "percentage": 0.2703363468439614, - "sampling_accuracy": 0.185926256 - }, - { - "id": "Sympathy", - "name": "Sympathy", - "category": "personality", - "percentage": 0.4925205306530542, - "sampling_accuracy": 0.218200048 - }, - { - "id": "Trust", - "name": "Trust", - "category": "personality", - "percentage": 0.4942472164375904, - "sampling_accuracy": 0.20805425600000002 - } - ], - "sampling_accuracy": 0.179704096 - }, - { - "id": "Neuroticism", - "name": "Neuroticism", - "category": "personality", - "percentage": 0.3012964526494173, - "children": [ - { - "id": "Anger", - "name": "Anger", - "category": "personality", - "percentage": 0.28154024762005125, - "sampling_accuracy": 0.113835312 - }, - { - "id": "Anxiety", - "name": "Anxiety", - "category": "personality", - "percentage": 0.27074726570766733, - "sampling_accuracy": 0.130378944 - }, - { - "id": "Depression", - "name": "Depression", - "category": "personality", - "percentage": 0.2530100050163511, - "sampling_accuracy": 0.160888416 - }, - { - "id": "Immoderation", - "name": "Immoderation", - "category": "personality", - "percentage": 0.2527382891839292, - "sampling_accuracy": 0.116421472 - }, - { - "id": "Self-consciousness", - "name": "Self-consciousness", - "category": "personality", - "percentage": 0.3228972078355042, - "sampling_accuracy": 0.182873056 - }, - { - "id": "Vulnerability", - "name": "Vulnerability", - "category": "personality", - "percentage": 0.20743276816254663, - "sampling_accuracy": 0.13511089599999998 - } - ], - "sampling_accuracy": 0.119994944 - } - ] - } - ] - }, - { - "id": "needs", - "name": "Needs", - "children": [ - { - "id": "Excitement_parent", - "name": "Excitement", - "category": "needs", - "percentage": 0.028407983332611967, - "children": [ - { - "id": "Challenge", - "name": "Challenge", - "category": "needs", - "percentage": 0.4156118557977969, - "sampling_accuracy": 0.592371728 - }, - { - "id": "Closeness", - "name": "Closeness", - "category": "needs", - "percentage": 0.1518914052691306, - "sampling_accuracy": 0.6847187680000001 - }, - { - "id": "Curiosity", - "name": "Curiosity", - "category": "needs", - "percentage": 0.11923726244843898, - "sampling_accuracy": 0.622813152 - }, - { - "id": "Excitement", - "name": "Excitement", - "category": "needs", - "percentage": 0.028407983332611967, - "sampling_accuracy": 0.611708416 - }, - { - "id": "Harmony", - "name": "Harmony", - "category": "needs", - "percentage": 0.1096710945531392, - "sampling_accuracy": 0.673503776 - }, - { - "id": "Ideal", - "name": "Ideal", - "category": "needs", - "percentage": 0.186921619256341, - "sampling_accuracy": 0.5899445600000001 - }, - { - "id": "Liberty", - "name": "Liberty", - "category": "needs", - "percentage": 0.3529499484254764, - "sampling_accuracy": 0.5582224 - }, - { - "id": "Love", - "name": "Love", - "category": "needs", - "percentage": 0.8064354722794397, - "sampling_accuracy": 0.7140377920000001 - }, - { - "id": "Practicality", - "name": "Practicality", - "category": "needs", - "percentage": 0.14928067208108364, - "sampling_accuracy": 0.649784736 - }, - { - "id": "Self-expression", - "name": "Self-expression", - "category": "needs", - "percentage": 0.9202369134879834, - "sampling_accuracy": 0.638071264 - }, - { - "id": "Stability", - "name": "Stability", - "category": "needs", - "percentage": 0.7677845260854704, - "sampling_accuracy": 0.66905568 - }, - { - "id": "Structure", - "name": "Structure", - "category": "needs", - "percentage": 0.630812244809267, - "sampling_accuracy": 0.025589840000000003 - } - ] - } - ] - }, - { - "id": "values", - "name": "Values", - "children": [ - { - "id": "Self-transcendence_parent", - "name": "Self-transcendence", - "category": "values", - "percentage": 0.12295428349471785, - "children": [ - { - "id": "Conservation", - "name": "Conservation", - "category": "values", - "percentage": 0.48270992236553717, - "sampling_accuracy": 0.245466992 - }, - { - "id": "Openness to change", - "name": "Openness to change", - "category": "values", - "percentage": 0.7108489315048623, - "sampling_accuracy": 0.255676416 - }, - { - "id": "Hedonism", - "name": "Hedonism", - "category": "values", - "percentage": 0.4544957729574186, - "sampling_accuracy": 0.249798992 - }, - { - "id": "Self-enhancement", - "name": "Self-enhancement", - "category": "values", - "percentage": 0.7924846027950024, - "sampling_accuracy": 0.23768368 - }, - { - "id": "Self-transcendence", - "name": "Self-transcendence", - "category": "values", - "percentage": 0.12295428349471785, - "sampling_accuracy": 0.228090208 - } - ] - } - ] - }, - { - "id": "sbh", - "name": "Social behavior", - "category": "sbr", - "children": [ - { - "id": "sbh_dom", - "name": "Wed. Mid night tweeter", - "category": "sbr", - "children": [ - { - "id": "Wednesday_parent", - "name": "Wed. tweeter", - "category": "behavior", - "percentage": 0.17083333333333334, - "children": [ - { - "id": "Sunday", - "name": "Sunday", - "category": "behavior", - "percentage": 0.12083333333333333 - }, - { - "id": "Monday", - "name": "Monday", - "category": "behavior", - "percentage": 0.14583333333333334 - }, - { - "id": "Tuesday", - "name": "Tuesday", - "category": "behavior", - "percentage": 0.10833333333333334 - }, - { - "id": "Wednesday", - "name": "Wednesday", - "category": "behavior", - "percentage": 0.17083333333333334 - }, - { - "id": "Thursday", - "name": "Thursday", - "category": "behavior", - "percentage": 0.15416666666666667 - }, - { - "id": "Friday", - "name": "Friday", - "category": "behavior", - "percentage": 0.16666666666666666 - }, - { - "id": "Saturday", - "name": "Saturday", - "category": "behavior", - "percentage": 0.13333333333333333 - } - ] - }, - { - "id": "1:00 am_parent", - "name": "Mid night tweeter", - "category": "behavior", - "percentage": 0.09583333333333334, - "children": [ - { - "id": "0:00 am", - "name": "0:00 am", - "category": "behavior", - "percentage": 0.05 - }, - { - "id": "1:00 am", - "name": "1:00 am", - "category": "behavior", - "percentage": 0.09583333333333334 - }, - { - "id": "2:00 am", - "name": "2:00 am", - "category": "behavior", - "percentage": 0.08333333333333333 - }, - { - "id": "3:00 am", - "name": "3:00 am", - "category": "behavior", - "percentage": 0.05416666666666667 - }, - { - "id": "4:00 am", - "name": "4:00 am", - "category": "behavior", - "percentage": 0.041666666666666664 - }, - { - "id": "5:00 am", - "name": "5:00 am", - "category": "behavior", - "percentage": 0.025 - }, - { - "id": "6:00 am", - "name": "6:00 am", - "category": "behavior", - "percentage": 0 - }, - { - "id": "7:00 am", - "name": "7:00 am", - "category": "behavior", - "percentage": 0 - }, - { - "id": "8:00 am", - "name": "8:00 am", - "category": "behavior", - "percentage": 0 - }, - { - "id": "9:00 am", - "name": "9:00 am", - "category": "behavior", - "percentage": 0 - }, - { - "id": "10:00 am", - "name": "10:00 am", - "category": "behavior", - "percentage": 0 - }, - { - "id": "11:00 am", - "name": "11:00 am", - "category": "behavior", - "percentage": 0.016666666666666666 - }, - { - "id": "12:00 pm", - "name": "12:00 pm", - "category": "behavior", - "percentage": 0.03333333333333333 - }, - { - "id": "1:00 pm", - "name": "1:00 pm", - "category": "behavior", - "percentage": 0.05 - }, - { - "id": "2:00 pm", - "name": "2:00 pm", - "category": "behavior", - "percentage": 0.05416666666666667 - }, - { - "id": "3:00 pm", - "name": "3:00 pm", - "category": "behavior", - "percentage": 0.0875 - }, - { - "id": "4:00 pm", - "name": "4:00 pm", - "category": "behavior", - "percentage": 0.041666666666666664 - }, - { - "id": "5:00 pm", - "name": "5:00 pm", - "category": "behavior", - "percentage": 0.041666666666666664 - }, - { - "id": "6:00 pm", - "name": "6:00 pm", - "category": "behavior", - "percentage": 0.075 - }, - { - "id": "7:00 pm", - "name": "7:00 pm", - "category": "behavior", - "percentage": 0.041666666666666664 - }, - { - "id": "8:00 pm", - "name": "8:00 pm", - "category": "behavior", - "percentage": 0.041666666666666664 - }, - { - "id": "9:00 pm", - "name": "9:00 pm", - "category": "behavior", - "percentage": 0.05 - }, - { - "id": "10:00 pm", - "name": "10:00 pm", - "category": "behavior", - "percentage": 0.05 - }, - { - "id": "11:00 pm", - "name": "11:00 pm", - "category": "behavior", - "percentage": 0.06666666666666667 - } - ] - } - ] - } - ] - } - ] - }, - "id": "14578997", - "source": "twitter", - "word_count": 2423 + "word_count": 5152, + "processed_language": "es", + "personality": [ + { + "trait_id": "big5_openness", + "name": "Openness", + "category": "personality", + "percentile": 0.8913101667165104, + "significant": true, + "children": [ + { + "trait_id": "facet_adventurousness", + "name": "Adventurousness", + "category": "personality", + "percentile": 0.9096744971004489, + "significant": true + }, + { + "trait_id": "facet_artistic_interests", + "name": "Artistic interests", + "category": "personality", + "percentile": 0.6521130849920853, + "significant": true + }, + { + "trait_id": "facet_emotionality", + "name": "Emotionality", + "category": "personality", + "percentile": 0.9686892883721694, + "significant": true + }, + { + "trait_id": "facet_imagination", + "name": "Imagination", + "category": "personality", + "percentile": 0.49993261229148017, + "significant": true + }, + { + "trait_id": "facet_intellect", + "name": "Intellect", + "category": "personality", + "percentile": 0.9232566081013882, + "significant": true + }, + { + "trait_id": "facet_liberalism", + "name": "Authority-challenging", + "category": "personality", + "percentile": 0.9292699881693138, + "significant": true + } + ] + }, + { + "trait_id": "big5_conscientiousness", + "name": "Conscientiousness", + "category": "personality", + "percentile": 0.7118221039810235, + "significant": true, + "children": [ + { + "trait_id": "facet_achievement_striving", + "name": "Achievement striving", + "category": "personality", + "percentile": 0.8907752553480937, + "significant": true + }, + { + "trait_id": "facet_cautiousness", + "name": "Cautiousness", + "category": "personality", + "percentile": 0.6091405615124645, + "significant": true + }, + { + "trait_id": "facet_dutifulness", + "name": "Dutifulness", + "category": "personality", + "percentile": 0.9027214332974964, + "significant": true + }, + { + "trait_id": "facet_orderliness", + "name": "Orderliness", + "category": "personality", + "percentile": 0.6694017446700516, + "significant": true + }, + { + "trait_id": "facet_self_discipline", + "name": "Self-discipline", + "category": "personality", + "percentile": 0.9542283382251218, + "significant": true + }, + { + "trait_id": "facet_self_efficacy", + "name": "Self-efficacy", + "category": "personality", + "percentile": 0.48175340668776473, + "significant": true + } + ] + }, + { + "trait_id": "big5_extraversion", + "name": "Extraversion", + "category": "personality", + "percentile": 0.4915708780830587, + "significant": true, + "children": [ + { + "trait_id": "facet_activity_level", + "name": "Activity level", + "category": "personality", + "percentile": 0.9577356488661941, + "significant": true + }, + { + "trait_id": "facet_assertiveness", + "name": "Assertiveness", + "category": "personality", + "percentile": 0.957653247182068, + "significant": true + }, + { + "trait_id": "facet_cheerfulness", + "name": "Cheerfulness", + "category": "personality", + "percentile": 0.33563991909178004, + "significant": true + }, + { + "trait_id": "facet_excitement_seeking", + "name": "Excitement-seeking", + "category": "personality", + "percentile": 0.9899601399525677, + "significant": true + }, + { + "trait_id": "facet_friendliness", + "name": "Outgoing", + "category": "personality", + "percentile": 0.9766049251857795, + "significant": true + }, + { + "trait_id": "facet_gregariousness", + "name": "Gregariousness", + "category": "personality", + "percentile": 0.7292080703918118, + "significant": true + } + ] + }, + { + "trait_id": "big5_agreeableness", + "name": "Agreeableness", + "category": "personality", + "percentile": 0.4899915107528602, + "significant": true, + "children": [ + { + "trait_id": "facet_altruism", + "name": "Altruism", + "category": "personality", + "percentile": 0.9609721870412024, + "significant": true + }, + { + "trait_id": "facet_cooperation", + "name": "Cooperation", + "category": "personality", + "percentile": 0.9355222244899897, + "significant": true + }, + { + "trait_id": "facet_modesty", + "name": "Modesty", + "category": "personality", + "percentile": 0.009533830328177895, + "significant": true + }, + { + "trait_id": "facet_morality", + "name": "Uncompromising", + "category": "personality", + "percentile": 0.38054524826094177, + "significant": true + }, + { + "trait_id": "facet_sympathy", + "name": "Sympathy", + "category": "personality", + "percentile": 0.48711285369339635, + "significant": true + }, + { + "trait_id": "facet_trust", + "name": "Trust", + "category": "personality", + "percentile": 0.999222048277077, + "significant": true + } + ] + }, + { + "trait_id": "big5_neuroticism", + "name": "Emotional range", + "category": "personality", + "percentile": 0.04886597127115544, + "significant": true, + "children": [ + { + "trait_id": "facet_anger", + "name": "Fiery", + "category": "personality", + "percentile": 0.09505816621700802, + "significant": true + }, + { + "trait_id": "facet_anxiety", + "name": "Prone to worry", + "category": "personality", + "percentile": 0.011771846332182423, + "significant": true + }, + { + "trait_id": "facet_depression", + "name": "Melancholy", + "category": "personality", + "percentile": 0.010000784096480309, + "significant": true + }, + { + "trait_id": "facet_immoderation", + "name": "Immoderation", + "category": "personality", + "percentile": 0.24213247416028616, + "significant": true + }, + { + "trait_id": "facet_self_consciousness", + "name": "Self-consciousness", + "category": "personality", + "percentile": 0.09048430416926112, + "significant": true + }, + { + "trait_id": "facet_vulnerability", + "name": "Susceptible to stress", + "category": "personality", + "percentile": 0.0833237709495177, + "significant": true + } + ] + } + ], + "needs": [ + { + "trait_id": "need_challenge", + "name": "Challenge", + "category": "needs", + "percentile": 0.2906122364369448, + "significant": true + }, + { + "trait_id": "need_closeness", + "name": "Closeness", + "category": "needs", + "percentile": 0.004465278370897829, + "significant": true + }, + { + "trait_id": "need_curiosity", + "name": "Curiosity", + "category": "needs", + "percentile": 0.08172174482813244, + "significant": true + }, + { + "trait_id": "need_excitement", + "name": "Excitement", + "category": "needs", + "percentile": 0.10081753630226953, + "significant": true + }, + { + "trait_id": "need_harmony", + "name": "Harmony", + "category": "needs", + "percentile": 0.0391564623668611, + "significant": true + }, + { + "trait_id": "need_ideal", + "name": "Ideal", + "category": "needs", + "percentile": 0.00014440569803991776, + "significant": true + }, + { + "trait_id": "need_liberty", + "name": "Liberty", + "category": "needs", + "percentile": 0.10351690723189355, + "significant": true + }, + { + "trait_id": "need_love", + "name": "Love", + "category": "needs", + "percentile": 0.001452747136131416, + "significant": true + }, + { + "trait_id": "need_practicality", + "name": "Practicality", + "category": "needs", + "percentile": 0.3158445752582525, + "significant": true + }, + { + "trait_id": "need_self_expression", + "name": "Self-expression", + "category": "needs", + "percentile": 0.009849560733778795, + "significant": true + }, + { + "trait_id": "need_stability", + "name": "Stability", + "category": "needs", + "percentile": 0.5212310261403146, + "significant": true + }, + { + "trait_id": "need_structure", + "name": "Structure", + "category": "needs", + "percentile": 0.00019580081988207487, + "significant": true + } + ], + "values": [ + { + "trait_id": "value_conservation", + "name": "Conservation", + "category": "values", + "percentile": 0.013781828932533713, + "significant": true + }, + { + "trait_id": "value_openness_to_change", + "name": "Openness to change", + "category": "values", + "percentile": 0.08075777292246905, + "significant": true + }, + { + "trait_id": "value_hedonism", + "name": "Hedonism", + "category": "values", + "percentile": 0.33520412663676424, + "significant": true + }, + { + "trait_id": "value_self_enhancement", + "name": "Self-enhancement", + "category": "values", + "percentile": 0.24843257490611187, + "significant": true + }, + { + "trait_id": "value_self_transcendence", + "name": "Self-transcendence", + "category": "values", + "percentile": 0.014619144390140726, + "significant": true + } + ], + "behavior": [ + { + "trait_id": "behavior_sunday", + "name": "Sunday", + "category": "behavior", + "percentage": 0.12351029252437704 + }, + { + "trait_id": "behavior_monday", + "name": "Monday", + "category": "behavior", + "percentage": 0.12351029252437704 + }, + { + "trait_id": "behavior_tuesday", + "name": "Tuesday", + "category": "behavior", + "percentage": 0.13109425785482123 + }, + { + "trait_id": "behavior_wednesday", + "name": "Wednesday", + "category": "behavior", + "percentage": 0.16143011917659805 + }, + { + "trait_id": "behavior_thursday", + "name": "Thursday", + "category": "behavior", + "percentage": 0.1570964247020585 + }, + { + "trait_id": "behavior_friday", + "name": "Friday", + "category": "behavior", + "percentage": 0.15926327193932827 + }, + { + "trait_id": "behavior_saturday", + "name": "Saturday", + "category": "behavior", + "percentage": 0.14409534127843987 + }, + { + "trait_id": "behavior_0000", + "name": "0:00 am", + "category": "behavior", + "percentage": 0.06717226435536294 + }, + { + "trait_id": "behavior_0100", + "name": "1:00 am", + "category": "behavior", + "percentage": 0.07258938244853738 + }, + { + "trait_id": "behavior_0200", + "name": "2:00 am", + "category": "behavior", + "percentage": 0.06500541711809317 + }, + { + "trait_id": "behavior_0300", + "name": "3:00 am", + "category": "behavior", + "percentage": 0.0552546045503792 + }, + { + "trait_id": "behavior_0400", + "name": "4:00 am", + "category": "behavior", + "percentage": 0.044420368364030335 + }, + { + "trait_id": "behavior_0500", + "name": "5:00 am", + "category": "behavior", + "percentage": 0.02600216684723727 + }, + { + "trait_id": "behavior_0600", + "name": "6:00 am", + "category": "behavior", + "percentage": 0.0032502708559046588 + }, + { + "trait_id": "behavior_0700", + "name": "7:00 am", + "category": "behavior", + "percentage": 0 + }, + { + "trait_id": "behavior_0800", + "name": "8:00 am", + "category": "behavior", + "percentage": 0.0032502708559046588 + }, + { + "trait_id": "behavior_0900", + "name": "9:00 am", + "category": "behavior", + "percentage": 0.0010834236186348862 + }, + { + "trait_id": "behavior_1000", + "name": "10:00 am", + "category": "behavior", + "percentage": 0.007583965330444204 + }, + { + "trait_id": "behavior_1100", + "name": "11:00 am", + "category": "behavior", + "percentage": 0.020585048754062838 + }, + { + "trait_id": "behavior_1200", + "name": "12:00 pm", + "category": "behavior", + "percentage": 0.03466955579631636 + }, + { + "trait_id": "behavior_1300", + "name": "1:00 pm", + "category": "behavior", + "percentage": 0.06067172264355363 + }, + { + "trait_id": "behavior_1400", + "name": "2:00 pm", + "category": "behavior", + "percentage": 0.06392199349945829 + }, + { + "trait_id": "behavior_1500", + "name": "3:00 pm", + "category": "behavior", + "percentage": 0.07692307692307693 + }, + { + "trait_id": "behavior_1600", + "name": "4:00 pm", + "category": "behavior", + "percentage": 0.04550379198266522 + }, + { + "trait_id": "behavior_1700", + "name": "5:00 pm", + "category": "behavior", + "percentage": 0.04658721560130011 + }, + { + "trait_id": "behavior_1800", + "name": "6:00 pm", + "category": "behavior", + "percentage": 0.06608884073672806 + }, + { + "trait_id": "behavior_1900", + "name": "7:00 pm", + "category": "behavior", + "percentage": 0.03791982665222102 + }, + { + "trait_id": "behavior_2000", + "name": "8:00 pm", + "category": "behavior", + "percentage": 0.04550379198266522 + }, + { + "trait_id": "behavior_2100", + "name": "9:00 pm", + "category": "behavior", + "percentage": 0.05200433369447454 + }, + { + "trait_id": "behavior_2200", + "name": "10:00 pm", + "category": "behavior", + "percentage": 0.05200433369447454 + }, + { + "trait_id": "behavior_2300", + "name": "11:00 pm", + "category": "behavior", + "percentage": 0.05200433369447454 + } + ], + "consumption_preferences": [ + { + "consumption_preference_category_id": "consumption_preferences_shopping", + "name": "Purchasing Preferences", + "consumption_preferences": [ + { + "consumption_preference_id": "consumption_preferences_automobile_ownership_cost", + "name": "Likely to be sensitive to ownership cost when buying automobiles", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_automobile_safety", + "name": "Likely to prefer safety when buying automobiles", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_clothes_quality", + "name": "Likely to prefer quality when buying clothes", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_clothes_style", + "name": "Likely to prefer style when buying clothes", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_clothes_comfort", + "name": "Likely to prefer comfort when buying clothes", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_influence_brand_name", + "name": "Likely to be influenced by brand name when making product purchases", + "score": 0.5 + }, + { + "consumption_preference_id": "consumption_preferences_influence_utility", + "name": "Likely to be influenced by product utility when making product purchases", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_influence_online_ads", + "name": "Likely to be influenced by online ads when making product purchases", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_influence_social_media", + "name": "Likely to be influenced by social media when making product purchases", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_influence_family_members", + "name": "Likely to be influenced by family when making product purchases", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_spur_of_moment", + "name": "Likely to indulge in spur of the moment purchases", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_credit_card_payment", + "name": "Likely to prefer using credit cards for shopping", + "score": 1 + } + ] + }, + { + "consumption_preference_category_id": "consumption_preferences_health_and_activity", + "name": "Health & Activity Preferences", + "consumption_preferences": [ + { + "consumption_preference_id": "consumption_preferences_eat_out", + "name": "Likely to eat out frequently", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_gym_membership", + "name": "Likely to have a gym membership", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_outdoor", + "name": "Likely to like outdoor activities", + "score": 1 + } + ] + }, + { + "consumption_preference_category_id": "consumption_preferences_environmental_concern", + "name": "Environmental Concern Preferences", + "consumption_preferences": [ + { + "consumption_preference_id": "consumption_preferences_concerned_environment", + "name": "Likely to be concerned about the environment", + "score": 1 + } + ] + }, + { + "consumption_preference_category_id": "consumption_preferences_entrepreneurship", + "name": "Entrepreneurship Preferences", + "consumption_preferences": [ + { + "consumption_preference_id": "consumption_preferences_start_business", + "name": "Likely to consider starting a business in next few years", + "score": 0.5 + } + ] + }, + { + "consumption_preference_category_id": "consumption_preferences_movie", + "name": "Movie Preferences", + "consumption_preferences": [ + { + "consumption_preference_id": "consumption_preferences_movie_romance", + "name": "Likely to like romance movies", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_movie_adventure", + "name": "Likely to like adventure movies", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_movie_horror", + "name": "Likely to like horror movies", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_movie_musical", + "name": "Likely to like musical movies", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_movie_historical", + "name": "Likely to like historical movies", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_movie_science_fiction", + "name": "Likely to like science-fiction movies", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_movie_war", + "name": "Likely to like war movies", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_movie_drama", + "name": "Likely to like drama movies", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_movie_action", + "name": "Likely to like action movies", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_movie_documentary", + "name": "Likely to like documentary movies", + "score": 1 + } + ] + }, + { + "consumption_preference_category_id": "consumption_preferences_music", + "name": "Music Preferences", + "consumption_preferences": [ + { + "consumption_preference_id": "consumption_preferences_music_rap", + "name": "Likely to like rap music", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_music_country", + "name": "Likely to like country music", + "score": 0.5 + }, + { + "consumption_preference_id": "consumption_preferences_music_r_b", + "name": "Likely to like R&B music", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_music_hip_hop", + "name": "Likely to like hip hop music", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_music_live_event", + "name": "Likely to attend live musical events", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_music_playing", + "name": "Likely to have experience playing music", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_music_latin", + "name": "Likely to like Latin music", + "score": 0.5 + }, + { + "consumption_preference_id": "consumption_preferences_music_rock", + "name": "Likely to like rock music", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_music_classical", + "name": "Likely to like classical music", + "score": 1 + } + ] + }, + { + "consumption_preference_category_id": "consumption_preferences_reading", + "name": "Reading Preferences", + "consumption_preferences": [ + { + "consumption_preference_id": "consumption_preferences_read_frequency", + "name": "Likely to read often", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_books_entertainment_magazines", + "name": "Likely to read entertainment magazines", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_books_non_fiction", + "name": "Likely to read non-fiction books", + "score": 1 + }, + { + "consumption_preference_id": "consumption_preferences_books_financial_investing", + "name": "Likely to read financial investment books", + "score": 0 + }, + { + "consumption_preference_id": "consumption_preferences_books_autobiographies", + "name": "Likely to read autobiographical books", + "score": 1 + } + ] + }, + { + "consumption_preference_category_id": "consumption_preferences_volunteering", + "name": "Volunteering Preferences", + "consumption_preferences": [ + { + "consumption_preference_id": "consumption_preferences_volunteer", + "name": "Likely to volunteer for social causes", + "score": 1 + } + ] + } + ], + "warnings": [] } \ No newline at end of file diff --git a/profiles/README.md b/profiles/README.md index 2918759..18ddcc6 100755 --- a/profiles/README.md +++ b/profiles/README.md @@ -1,30 +1,3 @@ # Profiles -This folder contains the profiles generated by the User Modeling service - -Each file will have the next layout: - -```json -{ - "tree": { - "id": "r", - "name": "root", - "children": [ - { - "id": "personality", - "name": "Big 5", - "children": [/* Big 5 */] - }, - { - "id": "needs", - "name": "Needs", - "children": [/* Needs */] - }, - { - "id": "Curiosity_parent", - "name": "Curiosity", - "children": [/* Values */], - }] - } -} -``` \ No newline at end of file +This folder contains the profiles generated by the Personality Insights service diff --git a/test/test.similarity.js b/test/test.similarity.js new file mode 100644 index 0000000..77c98bd --- /dev/null +++ b/test/test.similarity.js @@ -0,0 +1,33 @@ +/** + * Copyright 2015 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +var similarity = require('../app/util/similarity'); +var assert = require('assert'); +var path = require('path'); +var fs = require('fs'); + +describe('similarity', function() { + + it('should return 1 if source and target are the same', function() { + var origin = JSON.parse(fs.readFileSync(path.join(__dirname,'..','profiles','14578997.json'), 'utf8')); + var target = JSON.parse(fs.readFileSync(path.join(__dirname,'..','profiles','14578997.json'), 'utf8')); + assert.equal(1, similarity(origin, target, 'personality')) + assert.equal(1, similarity(origin, target, 'needs')) + assert.equal(1, similarity(origin, target, 'values')) + }); +}); \ No newline at end of file