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

org.erasmusmc.data_mining.ontology.api.Language Maven / Gradle / Ivy

The newest version!
/**
 * Peregrine is an indexing engine that can recognize concepts in human readable
 * text, based on a database (thesaurus) of known terms.
 *
 * Copyright 2005-2011 Erasmus University Medical Centre (EMC)
 * Copyright 2009-2011 Netherlands Bioinformatics Centre (NBIC)
 *
 * Contact us at: [email protected]
 *
 * This file is part of Peregrine. Peregrine is free software: you can
 * redistribute it and/or modify it under the terms of the GNU Affero General
 * Public License as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see .
 */
package org.erasmusmc.data_mining.ontology.api;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;

/**
 * Enum for the language with support for ISO 639-1 language codes.
 * 

* NOTE: This enum only contains a subset of the languages as defined in * ISO 639-1. */ @XmlEnum public enum Language { /** The ISO 639-1 code for the English language. */ @XmlEnumValue("en") EN("en"), /** The ISO 639-1 code for the German language. */ @XmlEnumValue("de") DE("de"), /** The ISO 639-1 code for the French language. */ @XmlEnumValue("fr") FR("fr"), /** The ISO 639-1 code for the Dutch language. */ @XmlEnumValue("nl") NL("nl"), /** The ISO 639-1 code for the Chinese language. */ @XmlEnumValue("zh") ZH("zh"), /** The ISO 639-1 code for the Danish language. */ @XmlEnumValue("da") DA("da"), /** The ISO 639-1 code for the Spanish language. */ @XmlEnumValue("es") ES("es"), /** The ISO 639-1 code for the Finnish language. */ @XmlEnumValue("fi") FI("fi"), /** The ISO 639-1 code for the Italian language. */ @XmlEnumValue("it") IT("it"), /** The ISO 639-1 code for the Norwegian language. */ @XmlEnumValue("no") NO("no"), /** The ISO 639-1 code for the Portuguese language. */ @XmlEnumValue("pt") PT("pt"), /** The ISO 639-1 code for the Romanian language. */ @XmlEnumValue("ro") RO("ro"), /** The ISO 639-1 code for the Russian language. */ @XmlEnumValue("ru") RU("ru"), /** The ISO 639-1 code for the Swedish language. */ @XmlEnumValue("sv") SV("sv"), /** The ISO 639-1 code for the Turkish language. */ @XmlEnumValue("tr") TR("tr"), /** The ISO 639-1 code for the Hungarian language. */ @XmlEnumValue("hu") HU("hu"); /** * The default language to use when no other language is defined. */ public static final Language DEFAULT = EN; /** * The ISO 639-1 code for this language. This is a two letter code that * uniquely identifies a language in the ISO 639-1 system. It does not * destinguish between different regional forms of the language. For * example American and British English can both be identified by the * ISO 639-1 code en. */ private final String iso639Code; /** * Constructor to create the enum type from the language code. * * @param languageCode The ISO 639-1 language code for the language. */ private Language(final String languageCode) { this.iso639Code = languageCode; } /** * Get the language code as defined in ISO 639-1 or RFC 3066. *

* The code is given in lowercase. * * @return The language code for the language. It is always a two letter * lowercase string. * * @see * ISO 639-1 * @see RFC 3066 */ public String getISO639Code() { return iso639Code; } /** * Factory method to create a Language enum value from the ISO 639-1 code * of the language. * * @param iso639Code A valid two letter lowercase ISO 639-1 code. * * @return The corresponding Language enum value. */ public static Language fromISO639Code(final String iso639Code) { for (final Language value : values()) { if (value.getISO639Code().equals(iso639Code)) { return value; } } return null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy