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

com.articulate.sigma.nlg.Noun Maven / Gradle / Ivy

Go to download

Sigma knowledge engineering system is an system for developing, viewing and debugging theories in first order logic. It works with Knowledge Interchange Format (KIF) and is optimized for the Suggested Upper Merged Ontology (SUMO) www.ontologyportal.org.

There is a newer version: 2.10
Show newest version
package com.articulate.sigma.nlg;

import com.articulate.sigma.KB;

/**
 * Provides functionality related to nouns and NLG.
 */

public class Noun {


    /**************************************************************************************************************
     * Look at first letter of input to determine whether it should be preceded by "a" or "an".
     * @param input
     * @return
     * "a" or "an"
     */
    public static String aOrAn(String input) {
        String article;
        String temp = input.toLowerCase();
        if(!NLGStringUtils.isVowel(temp.charAt(0)))   {
            article = "a";
        }
        else    {
            article = "an";
        }

        return article;
    }

    /**************************************************************************************************************
     * Determine whether the given noun requires an indefinite article ("a"/"an").
     * @param noun
     * @param kb
     * @return
     */
    public static boolean takesIndefiniteArticle(String noun, KB kb)  {
        // Return false if Entity.
        if (noun.equals("Entity"))   {
            return false;
        }

        if (kb.isSubclass(noun, "Entity")) {
            return !kb.isSubclass(noun, "Substance");
        }
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy