Class EmailNameParserCommand

  • All Implemented Interfaces:
    com.optimaize.command4j.Command<String,​org.nameapi.ontology5.services.email.emailnameparser.EmailNameParserResult>, com.optimaize.command4j.commands.CombinableCommand<String,​org.nameapi.ontology5.services.email.emailnameparser.EmailNameParserResult>

    public class EmailNameParserCommand
    extends NameApiBaseCommand<org.nameapi.client.services.email.emailnameparser.RestPort,​String,​org.nameapi.ontology5.services.email.emailnameparser.EmailNameParserResult>
    Analyzes the email address and attempts to extract a person's name.

    Example: john.doe@example.com => [john, doe]

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

    • peter.johnson@example.com
    • peter.a.johnson@example.com
    • peterjohnson@example.com
    • pjohnson@example.com
    • peterj@example.com
    • peter@example.com
    • johnson@example.com
    • johnson.peter@example.com
    • johnsonpeter@example.com

    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.

    • Constructor Detail

      • EmailNameParserCommand

        public EmailNameParserCommand()
    • Method Detail

      • call

        @NotNull
        public org.nameapi.ontology5.services.email.emailnameparser.EmailNameParserResult call​(@NotNull
                                                                                               com.google.common.base.Optional<String> arg,
                                                                                               @NotNull
                                                                                               com.optimaize.command4j.ExecutionContext ec)
                                                                                        throws Exception
        Throws:
        Exception
      • createPort

        @NotNull
        protected Callable<org.nameapi.client.services.email.emailnameparser.RestPort> createPort​(@NotNull
                                                                                                  com.optimaize.command4j.ExecutionContext ec)
        Specified by:
        createPort in class com.optimaize.anythingworks.client.rest.RestBaseCommand<org.nameapi.client.services.email.emailnameparser.RestPort,​String,​org.nameapi.ontology5.services.email.emailnameparser.EmailNameParserResult>