Skip to content

Commit 3531d8f

Browse files
author
Norbert Nagy
committed
rlpnc-7455 add gender to names
1 parent 0df0c57 commit 3531d8f

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2022 Basis Technology Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.basistech.rosette.apimodel;
17+
18+
public enum Gender {
19+
20+
FEMALE(0.99),
21+
NONBINARY(0.5),
22+
MALE(0.01);
23+
24+
private final double value;
25+
26+
Gender(double value) {
27+
this.value = value;
28+
}
29+
30+
public double getValue() {
31+
return value;
32+
}
33+
}

model/src/main/java/com/basistech/rosette/apimodel/Name.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public class Name {
5151
*/
5252
LanguageCode language;
5353

54+
55+
Gender gender;
56+
57+
5458
/**
5559
* Default constructor for lombok
5660
*
@@ -64,6 +68,15 @@ public Name(String name, String entityType, ISO15924 script, LanguageCode langua
6468
this.entityType = entityType;
6569
this.script = script;
6670
this.language = language;
71+
this.gender = null;
72+
}
73+
74+
public Name(String name, String entityType, ISO15924 script, LanguageCode language, Gender gender) {
75+
this.text = name;
76+
this.entityType = entityType;
77+
this.script = script;
78+
this.language = language;
79+
this.gender = gender;
6780
}
6881

6982
/**
@@ -77,5 +90,6 @@ public Name(String name) {
7790
this.entityType = "PERSON";
7891
this.script = ISO15924.Zyyy;
7992
this.language = LanguageCode.UNKNOWN;
93+
this.gender = null;
8094
}
8195
}

0 commit comments

Comments
 (0)