Skip to content

Commit 33914b5

Browse files
feat: Add combined norm (average between M and F norms)
1 parent 05f67a8 commit 33914b5

4 files changed

Lines changed: 22 additions & 10 deletions

File tree

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,17 @@ answers300 = json.loads(data)
140140

141141
The **compute** method is used to evaluate the answers, see the table below with the parameters:
142142

143-
| Parameters | Type | Description |
144-
| ------------- | --------- | --------------------------------------------------------- |
145-
| sex | string | Sex assigned at birth (M or F). |
146-
| age | int | Age (in years between 10 and 110 years old). |
147-
| answers | dict | Standardized dictionary with answers. |
148-
| compare | boolean | If true, it shows the user's answers and reverse score. |
143+
| Parameters | Type | Description |
144+
| ------------- | --------- | ------------------------------------------------------------------------------------ |
145+
| sex | string | Sex assigned at birth or self-identified gender (M, F, or N for neutral/non-binary). |
146+
| age | int | Age (in years between 10 and 110 years old). |
147+
| answers | dict | Standardized dictionary with answers. |
148+
| compare | boolean | If true, it shows the user's answers and reverse score. |
149+
150+
✅ Explanation:
151+
- `sex="N"` represents a **neutral or non-binary** individual.
152+
- In this case, the **algorithm averages the male and female norms** to generate standardized scores.
153+
- This approach ensures compatibility with the original calculation logic while providing inclusive results.
149154

150155
Calculate the Big Five for a **40-year-old man**:
151156

@@ -165,6 +170,12 @@ Calculating the Big Five for a **25-year-old woman**:
165170
IpipNeo(question=120).compute(sex="F", age=25, answers=answers120)
166171
```
167172

173+
Calculating the Big Five for a **25-year-old neutral**:
174+
175+
```python
176+
IpipNeo(question=120).compute(sex="N", age=25, answers=answers120)
177+
```
178+
168179
An example of the output of the results:
169180

170181
```json

ipipneo/quiz.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,11 @@ def main() -> None:
381381
replies = map(
382382
input,
383383
chain(
384-
["\n> What is your sex Male or Female? M / F: "],
385-
repeat("Please, only M or F are valid! Try again: "),
384+
["\n> What is your sex? Male, Female, or Neutral? M / F / N: "],
385+
repeat("Please, only M, F, or N are valid! Try again: "),
386386
),
387387
)
388-
sex = str(next(filter({"F", "f", "M", "m"}.__contains__, replies)))
388+
sex = str(next(filter({"F", "f", "M", "m", "N", "n"}.__contains__, replies)))
389389

390390
replies = map(
391391
input,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
1111
long_description = "\n" + fh.read()
1212

13-
VERSION = "1.12.1"
13+
VERSION = "1.13.1"
1414
DESCRIPTION = "Big 5 IPIP-NEO Personality Traits"
1515
LONG_DESCRIPTION = "Library with a self-administered questionnaire that assesses a person's personality according to the Big Five Model, using the IPIP-NEO."
1616

test/test_utility.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def test_raise_if_sex_is_invalid(self) -> None:
4343

4444
self.assertEqual(raise_if_sex_is_invalid(sex="M"), True)
4545
self.assertEqual(raise_if_sex_is_invalid(sex="F"), True)
46+
self.assertEqual(raise_if_sex_is_invalid(sex="N"), True)
4647

4748
def test_raise_if_age_is_invalid(self) -> None:
4849
with self.assertRaises(BaseException):

0 commit comments

Comments
 (0)