Package org.foray.hyphen.util

Examples of org.foray.hyphen.util.NaturalLanguage


     * language description.
     * @param iso639 The ISO-639 instance for the language sought.
     * @return The suitable instance for {@code iso639}.
     */
    public NaturalLanguage getNaturalLanguage(final Language iso639) {
        NaturalLanguage nl = this.languages.get(iso639);
        if (nl != null) {
            return nl;
        }
        try {
            nl = this.parseNaturalLanguage(iso639.getAbbrev3());
View Full Code Here


     * instance already exists for it.
     */
    public NaturalLanguage makeNaturalLanguage(
            final String languageCode) {
        final Language iso639 = Language.findFromAlpha(languageCode);
        final NaturalLanguage existingLang = this.getNaturalLanguage(iso639);
        if (existingLang != null) {
            /* If the instance already exists, don't return a new one for the
             * same language code. */
            return null;
        }
        final NaturalLanguage newLang = new NaturalLanguage();
        /* TODO: It is ugly to expose this instance before it has been parsed.
         * Instead we need to add a concept of "locking" to this class that
         * will make it effectively immutable, and register it at that time
         * instead of now. */
        this.languages.put(iso639, newLang);
View Full Code Here

        final URL naturalLanguageDir = this.naturalLanguageDir;
        final String filePrefix = languageCode + "-language";
        if (naturalLanguageDir == null) {
            return null;
        }
        NaturalLanguage nl = null;

        /* Use the language code as the base name for the file. */

        /* First look for the serialized object. */
        String fileName = filePrefix
View Full Code Here

TOP

Related Classes of org.foray.hyphen.util.NaturalLanguage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.