Skip to content

Commit 6b661c1

Browse files
authored
Merge pull request #254 from rosette-api/rlpnc-7455-use-gender-property-for-pairwise-matching
rlpnc-7455 Use gender property for pairwise matching
2 parents 059b648 + b34f0c4 commit 6b661c1

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
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: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,15 @@ public class Name {
5151
*/
5252
LanguageCode language;
5353

54+
55+
/**
56+
* @return gender of the name, {@link Gender}
57+
*/
58+
Gender gender;
59+
60+
5461
/**
55-
* Default constructor for lombok
62+
* Default constructor for lombok (gender is optional)
5663
*
5764
* @param name
5865
* @param entityType
@@ -64,6 +71,24 @@ public Name(String name, String entityType, ISO15924 script, LanguageCode langua
6471
this.entityType = entityType;
6572
this.script = script;
6673
this.language = language;
74+
this.gender = null;
75+
}
76+
77+
/**
78+
* Default constructor for lombok with gender
79+
*
80+
* @param name
81+
* @param entityType
82+
* @param script
83+
* @param language
84+
* @param gender
85+
*/
86+
public Name(String name, String entityType, ISO15924 script, LanguageCode language, Gender gender) {
87+
this.text = name;
88+
this.entityType = entityType;
89+
this.script = script;
90+
this.language = language;
91+
this.gender = gender;
6792
}
6893

6994
/**
@@ -77,5 +102,6 @@ public Name(String name) {
77102
this.entityType = "PERSON";
78103
this.script = ISO15924.Zyyy;
79104
this.language = LanguageCode.UNKNOWN;
105+
this.gender = null;
80106
}
81107
}

0 commit comments

Comments
 (0)