com.articulate.sigma.nlg.Noun Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sigma-component Show documentation
Show all versions of sigma-component Show documentation
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.
The 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;
}
}