All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nameapi.client.services.email.emailnameparser.EmailNameParserCommand Maven / Gradle / Ivy

The newest version!
package org.nameapi.client.services.email.emailnameparser;

import com.google.common.base.Optional;
import com.optimaize.command4j.ExecutionContext;
import org.jetbrains.annotations.NotNull;
import org.nameapi.client.services.NameApiBaseCommand;
import org.nameapi.ontology5.services.email.emailnameparser.EmailNameParserResult;

import java.util.concurrent.Callable;

/**
 * Analyzes the email address and attempts to extract a person's name.
 *
 * 

Example: [email protected] => [john, doe]

* *

The service attempts to detect several kinds of syntax, such as: *

*

* *

Names are not formatted to correct case, they are left the way they appeared in the input.

* *

Difference to the older EmailNameParserCommand: * The enum EmailAddressParsingResultType2 uses FUNCTIONAL instead of DEPARTMENT and TECHNICAL because the two can hardly be told apart. *

*/ public class EmailNameParserCommand extends NameApiBaseCommand { private static final String SERVICE_PATH = "/email/emailnameparser"; public EmailNameParserCommand() { super(RestPort.class); } @Override @NotNull public EmailNameParserResult call(@NotNull Optional arg, @NotNull ExecutionContext ec) throws Exception { return getPort(ec).call(getApiKey(ec), arg.get()); } @NotNull @Override protected Callable createPort(@NotNull final ExecutionContext ec) { return new Callable() { @Override public RestPort call() throws Exception { return new RestPort(makeClient(ec), SERVICE_PATH); } }; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy