GithubHelp home page GithubHelp logo

alheimsins / b5-johnson-120-ipip-neo-pi-r Goto Github PK

View Code? Open in Web Editor NEW
58.0 58.0 59.0 1.08 MB

Big Five Johnson 120 IPIP-NEO-PI-R questions

License: MIT License

JavaScript 99.84% Shell 0.16%
hacktoberfest

b5-johnson-120-ipip-neo-pi-r's People

Contributors

aimarekin avatar askeroff avatar asveloper avatar catalintopala avatar dancek avatar dependabot[bot] avatar eliamue avatar eneadm avatar grazzianos avatar greenkeeper[bot] avatar hans5958 avatar hialisabet avatar ialsowalkdogs avatar jduranj avatar jfrcom avatar jordy-u avatar lakuapik avatar maccyber avatar masnormen avatar renovate-bot avatar renovate[bot] avatar rjjuina avatar shiifu avatar swedishbarbarossa avatar thepunitsingh avatar timetree98 avatar tofe19 avatar vzrenggamani avatar yantene avatar zrrrzzt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

b5-johnson-120-ipip-neo-pi-r's Issues

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

solved: compress translations

here is a snippet to compress all questions from 380 to 46 KByte = 12% of old size

this is useful to build single file apps (standalone HTML files)

/*
npm install json-stringify-pretty-compact @alheimsins/b5-johnson-120-ipip-neo-pi-r
*/

const stringify = require("json-stringify-pretty-compact"); // pretty json
const b5languages = require('@alheimsins/b5-johnson-120-ipip-neo-pi-r/data/languages.json');
const fs = require('fs');

const outFile = 'bigfive-data.generated.json';
const line_width = 120; // pretty json

const input = {};
input.languages = b5languages.reduce((acc, lang) => {
  acc[lang.id] = {
    questions: require(`@alheimsins/b5-johnson-120-ipip-neo-pi-r/data/${lang.id}/questions.json`),
    //choices: require(`@alheimsins/b5-johnson-120-ipip-neo-pi-r/data/${lang.id}/choices.json`),
  };
  return acc;
}, {});

const sizeBefore = Math.round(JSON.stringify(input).length / 1000);

// reshape data into a tree of domains and facets
const res = {};

res.languages = {};
Object.keys(input.languages).forEach(language_id => {
  const language = input.languages[language_id];
  res.languages[language_id] = {};
  res.languages[language_id].domains = language.questions.reduce((acc, question) => {
    const { text, domain: domain_uppercase, facet: facet_num, keyed } = question;
    const domain = domain_uppercase.toLowerCase();
    (domain in acc) || (acc[domain] = []);
    const facet_id = facet_num - 1;
    (facet_id in acc[domain]) || (acc[domain][facet_id] = [ '' ]); // use empty string instead of null
    const answer_id = (keyed == 'plus') ? 0 : 1;
    acc[domain][facet_id][answer_id] = text;
    return acc;
  }, { o: [], c: [], e: [], a: [], n: [] }); // sort keys to ocean
});

const sizeAfter = Math.round(JSON.stringify(res).length / 1000);
console.log(`compressed data from ${sizeBefore} to ${sizeAfter} KByte = ${Math.round(sizeAfter/sizeBefore*100)}% of old size`);

//const outString = JSON.stringify(res); // minified json
const outString = stringify(res, {maxLength: line_width, indent: 2}) // pretty json

const sizeAfterPretty = Math.round(outString.length / 1000);
console.log(`pretty compressed data from ${sizeBefore} to ${sizeAfterPretty} KByte = ${Math.round(sizeAfterPretty/sizeBefore*100)}% of old size`);

fs.writeFileSync(outFile, outString, 'utf8');
console.log(`done ${outFile}`);

answers are stored in arrays like [ "plus answer", "minus answer" ]
additional data can be stored in index 2 like [ "plus answer", "", { id: "optional-id" } ]

sample result
{
  "languages": {
    "en": {
      "domains": {
        "o": [
          ["Like to get lost in thought"],
          ["See beauty in things that others might not notice", "Do not enjoy going to art museums"],
          ["Feel others' emotions", "Don't understand people who get emotional"],
          ["Prefer variety to routine", "Am attached to conventional ways"],
          ["Love to read challenging material", "Am not interested in theoretical discussions"],
          ["Believe that there is no absolute right and wrong", "Believe that we should be tough on crime"]
        ],
        "c": [
          ["Know how to get things done"],
          ["Like to tidy up", "Leave my belongings around"],
          ["Tell the truth", "Break my promises"],
          ["Do more than what's expected of me", "Put little time and effort into my work"],
          ["Carry out my plans", "Have difficulty starting tasks"],
          ["", "Act without thinking"]
        ],
        "e": [
          ["Feel comfortable around people", "Keep others at a distance"],
          ["Talk to a lot of different people at parties", "Avoid crowds"],
          ["Take control of things", "Wait for others to lead the way"],
          ["Do a lot in my spare time", "Like to take it easy"],
          ["Act wild and crazy"],
          ["Look at the bright side of life"]
        ],
        "a": [
          ["Trust what people say", "Distrust people"],
          ["", "Obstruct others' plans"],
          ["Am concerned about others", "Take no time for others"],
          ["", "Get back at others"],
          ["", "Boast about my virtues"],
          ["Feel sympathy for those who are worse off than myself", "Try not to think about the needy"]
        ],
        "n": [
          ["Get stressed out easily"],
          ["Lose my temper", "Am not easily annoyed"],
          ["Am often down in the dumps", "Feel comfortable with myself"],
          ["Only feel comfortable with friends", "Am not bothered by difficult social situations"],
          ["Go on binges", "Am able to control my cravings"],
          ["Feel that I'm unable to deal with things", "Remain calm under pressure"]
        ]
      }
    }
  }
}

Subjective pronoun translations?

In implementing this package I have noticed three things.

  1. All questions imply an omitted subjective pronoun at the start of the question. For English this would be "I", Norwegian "Jeg".
  2. This subjective pronoun is not included in the package anywhere (as far as I can see). Presenting the questions without it can be confusing, and since there are many translations it takes some work to find them for each and implement separately.
  3. The package is overall very smooth to use. Good job!

I would presume translated pronouns exist in the "downstream" repositories. In my opinion it would make sense if they were brought down to this level, which would also spare me some work.

I would suggest putting it in getInfo().languages[ i ].pronoun

Context Error in Untranslatable Spanish String

The string "Back" used in the questionnaire to return to the previous page in Spanish is currently incorrectly translated as "Espalda", most likely due to a context issue.

"Espalda" in Spanish means the part of the body (the back), not the action (to go back). The correct translation would be "Atrás" (other words could also fit the context).

This string does not appear in the data folder. Perhaps it was translated manually by the developers with Google Translate, which would explain the lack of context.

Need help with translations

Need help with translations.

The test is currently translated to:
Finnish, Simplified Chinese, Thai, Italian, English, Norwegian, Spanish, Icelandic (partly), Dutch, Swedish (partly), Croatian, French, Estonian, German, Japanese, Urdru and Portuguese (brazil)

If you want to help by translating the items to other languages this is how you do it.

  • clone the repo
  • find a language you know in data
  • duplicate the folder and rename it to the language you will translate
  • use ISO 639-1 language code as folder name.
  • translate the "text"-property for choices.js and questions.json
  • don't change filenames, ids or any other properties
  • add your language code to the data/languages.json file
  • submit pull request
  • happiness :-)

Change from ISO 639-1 to IETF language tag

We have to change the usage of ISO 639-1 to IETF language tag i.e. https://github.com/BelkaLab/language-cultures to support language cultures as Brazillian Portuguese (pt-BR)

bigfive-web uses the language code to get the language name here:
https://github.com/Alheimsins/bigfive-web/blob/master/pages/index.js#L7

... or we could provide the language name in the metadata

... or write a own module that supports both ISO 639-1 and ISO 639-1 with IETF language tag

image

store choices in json format

to make the data files usable from commonJS and ES6

cd @alheimsins/b5-johnson-120-ipip-neo-pi-r
find ./data -name choices.js | while read i
do
  o=${i}on
  node -e "console.log(JSON.stringify(require('$i'), null, 2))" >$o
  git rm $i
  git add $o
  echo converted $i to $o
done
git commit -m 'store choices in json format'

sample use:

const choices = await (await fetch(`/data/${lang}/choices.json`)).json();

import() only works with *.js files

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.