Skip to content

Commit

Permalink
update to v2.0.15
Browse files Browse the repository at this point in the history
update to v2.0.15
  • Loading branch information
namsor committed Jul 17, 2021
1 parent 9f24273 commit 3a8766a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>namsor-sdk2</artifactId>
<version>2.0.13</version>
<version>2.0.15</version>
</dependency>
</dependencies>
<build>
Expand Down
19 changes: 18 additions & 1 deletion src/main/java/com/namsor/tools/NamSorTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,17 @@ public NamSorTools(CommandLine commandLineOptions) {
if (apiKey == null || apiKey.isEmpty()) {
throw new IllegalStateException("Missing API KEY");
}

ApiClient client = new ApiClient();
client.setConnectTimeout(TIMEOUT);
client.setReadTimeout(TIMEOUT);
client.setWriteTimeout(TIMEOUT);
client.setApiKey(apiKey);
String usraceethnicityoption = commandLineOptions.getOptionValue("usraceethnicityoption");
if (usraceethnicityoption != null && !usraceethnicityoption.isEmpty()) {
Logger.getLogger(NamSorTools.class.getName()).info("Overriding usraceethnicityoption=" + usraceethnicityoption);
client.addDefaultHeader(NAMSOR_OPTION_USRACEETHNICITY_TAXO, usraceethnicityoption);
}
String basePath = commandLineOptions.getOptionValue("basePath");
if (basePath != null && !basePath.isEmpty()) {
Logger.getLogger(NamSorTools.class.getName()).info("Overriding basePath=" + basePath);
Expand Down Expand Up @@ -237,6 +243,10 @@ public String digest(String inClear) {
}
return null;
}*/
public static final String NAMSOR_OPTION_USRACEETHNICITY_TAXO = "X-OPTION-USRACEETHNICITY-TAXONOMY";
public static final String NAMSOR_OPTION_USRACEETHNICITY_TAXO_4CLASSES = "USRACEETHNICITY-4CLASSES";
public static final String NAMSOR_OPTION_USRACEETHNICITY_TAXO_4CLASSESCLASSIC = "USRACEETHNICITY-4CLASSES-CLASSIC";
public static final String NAMSOR_OPTION_USRACEETHNICITY_TAXO_6CLASSES = "USRACEETHNICITY-6CLASSES";

public static void main(String[] args) {
// create the parser
Expand Down Expand Up @@ -332,6 +342,12 @@ public static void main(String[] args) {
.longOpt("help")
.required(false)
.build();
Option usraceethnicityoption = Option.builder("usraceethnicityoption").argName("usraceethnicityoption")
.hasArg(true)
.desc("extra usraceethnicity option "+NAMSOR_OPTION_USRACEETHNICITY_TAXO_4CLASSES+" "+NAMSOR_OPTION_USRACEETHNICITY_TAXO_4CLASSESCLASSIC+" "+NAMSOR_OPTION_USRACEETHNICITY_TAXO_6CLASSES)
.longOpt("usraceethnicityoption")
.required(false)
.build();

Option service = Option.builder("service").argName("service")
.hasArg(true)
Expand Down Expand Up @@ -362,6 +378,7 @@ public static void main(String[] args) {
options.addOption(countryIso2);
options.addOption(outputFileRecover);
options.addOption(digest);
options.addOption(usraceethnicityoption);
options.addOption(help);

Options helpOptions = new Options();
Expand Down Expand Up @@ -943,7 +960,7 @@ private void append(Writer writer, String[] outputHeaders, Map input, Map output
} else if (outputObj instanceof PersonalNameGenderedOut) {
PersonalNameGenderedOut personalNameGenderedOut = (PersonalNameGenderedOut) outputObj;
String scriptName = personalNameGenderedOut.getScript();//NamSorTools.computeScriptFirst(personalNameGenderedOut.getName());
writer.append(personalNameGenderedOut.getLikelyGender().getValue() + separatorOut + personalNameGenderedOut.getScore() + separatorOut + personalNameGenderedOut.getGenderScale() + separatorOut + scriptName + separatorOut);
writer.append(personalNameGenderedOut.getLikelyGender().getValue() + separatorOut + personalNameGenderedOut.getScore() + separatorOut + personalNameGenderedOut.getProbabilityCalibrated() + separatorOut + personalNameGenderedOut.getGenderScale() + separatorOut + scriptName + separatorOut);
} else if (outputObj instanceof PersonalNameGeoOut) {
PersonalNameGeoOut personalNameGeoOut = (PersonalNameGeoOut) outputObj;
String scriptName = personalNameGeoOut.getScript();//NamSorTools.computeScriptFirst(personalNameGeoOut.getName());
Expand Down

0 comments on commit 3a8766a

Please sign in to comment.