001 // This file is part of the Attempto Java Packages. 002 // Copyright 2008, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch). 003 // 004 // The Attempto Java Packages is free software: you can redistribute it and/or modify it under the 005 // terms of the GNU Lesser General Public License as published by the Free Software Foundation, 006 // either version 3 of the License, or (at your option) any later version. 007 // 008 // The Attempto Java Packages is distributed in the hope that it will be useful, but WITHOUT ANY 009 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 010 // PURPOSE. See the GNU Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with the Attempto 013 // Java Packages. If not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.ape; 016 017 import java.util.Arrays; 018 import java.util.HashSet; 019 import java.util.Set; 020 021 /** 022 * This class contains the function words of ACE. These words have a predefined meaning and cannot 023 * be redefined in the lexicon. 024 * 025 * @author Tobias Kuhn 026 */ 027 public class FunctionWords { 028 029 // TODO: Store also the capitalized words 030 private static HashSet<String> functionWords = new HashSet<String>(Arrays.asList(new String[] { 031 "null", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", 032 "twelve", "dozen", "there", "and", "or", "not", "that", "than", "of", "if", "then", "such", "be", "provably", 033 "more", "most", "are", "is", "the", "a", "an", "some", "no", "every", "all", "each", "which", "its", "his", 034 "her", "their", "whose", "it", "he", "she", "they", "him", "them", "itself", "himself", "herself", 035 "themselves", "someone", "somebody", "something", "nobody", "nothing", "everyone", "everybody", "everything", 036 "what", "who", "how", "where", "when", "by" 037 })); 038 039 private FunctionWords() {} // no instances allowed 040 041 /** 042 * Checks whether a certain string represents a function word. 043 * 044 * @param s The string to be checked. 045 * @return true if the string represents a function word. 046 */ 047 public static boolean isFunctionWord(String s) { 048 return functionWords.contains(s); 049 } 050 051 /** 052 * Returns a set that contains all function words. 053 * 054 * @return A list containing all function words. 055 */ 056 public static Set<String> getFunctionWords() { 057 return new HashSet<String>(functionWords); 058 } 059 060 }