Word.java
Go to the documentation of this file.
00001 package instruction.semanticObjects;
00002 
00003 import java.util.ArrayList;
00004 import java.util.Iterator;
00005 
00011 public class Word extends SemanticObject {
00012 
00013         public static final int TYPE_UNKNOWN = - 1;
00014         public static final int TYPE_NOUN = 0;
00015         public static final int TYPE_VERB_INFINITIVE = 1;
00016         public static final int TYPE_ADJ = 2;
00017         public static final int TYPE_ADV = 3;
00018         public static final int TYPE_PARTICLE = 4;
00019         public static final int TYPE_NUMBER = 5;
00020         public static final int TYPE_CONJ = 7;
00021         public static final int TYPE_PRONOUN = 8;
00022         public static final int TYPE_PREPOSITION = 9;
00023         public static final int TYPE_ARTICLE = 10;
00024         public static final int TYPE_PUNCTUATION = 11;
00025         public static final int TYPE_PAST_PARTICIPLE = 12;
00026         public static final int TYPE_GERUND = 13;
00027 
00031         private int type;
00032 
00036         private String label;
00037 
00043         private ArrayList<String> synSetIDs = new ArrayList<String>();
00044 
00050         private ArrayList<String> cycConcepts = new ArrayList<String>();
00051 
00055         public Word () {
00056 
00057                 type = TYPE_UNKNOWN;
00058                 label = "";
00059         }
00060 
00061         public Word ( int type, String label ) {
00062 
00063                 this.type = type;
00064                 this.label = label;
00065         }
00066 
00067         public ArrayList<String> getSynSetIDs() {
00068 
00069                 return synSetIDs;
00070         }
00071 
00072         public ArrayList<String> getCycConcepts() {
00073 
00074                 return cycConcepts;
00075         }
00076         
00077         public void setCycConcepts(ArrayList<String> concepts) {
00078                 cycConcepts = concepts;
00079         }
00080 
00081         public String getLabel() {
00082 
00083                 return label;
00084         }
00085 
00086         public int getType() {
00087 
00088                 return type;
00089         }
00090 
00091         public void setLabel( String label ) {
00092 
00093                 this.label = label;
00094         }
00095 
00096         public void setType( int type ) {
00097 
00098                 this.type = type;
00099         }
00100 
00101         public void setSynSetIDs( ArrayList<String> synsets ) {
00102 
00103                 synSetIDs = synsets;
00104         }
00105 
00106         public String toString() {
00107 
00108                 String str = "(" + label + "," + typeToString( type ) + ",[";
00109 
00110                 str += synSetIDs.size() + "/";
00111                 for ( Iterator<String> i = cycConcepts.iterator(); i.hasNext(); ) {
00112                         str += i.next();
00113                         if ( i.hasNext() )
00114                                 str += ",";
00115                 }
00116                 str += "])";
00117 
00118                 return str;
00119         }
00120         
00121 
00122 
00123         public String typeToString(int type) {
00124                 String str = "N/A";
00125                 switch (type) {
00126                 case TYPE_UNKNOWN:
00127                         str = "?";
00128                         break;
00129                 case TYPE_NOUN:
00130                         str = "N";
00131                         break;
00132                 case TYPE_VERB_INFINITIVE:
00133                         str = "V";
00134                         break;
00135                 case TYPE_ADJ:
00136                         str = "ADJ";
00137                         break;
00138                 case TYPE_ADV:
00139                         str = "ADV";
00140                         break;
00141                 case TYPE_PARTICLE:
00142                         str = "PART";
00143                         break;
00144                 case TYPE_NUMBER:
00145                         str = "NUMBER";
00146                         break;
00147                 case TYPE_CONJ:
00148                         str = "CONJ";
00149                         break;
00150                 case TYPE_PRONOUN:
00151                         str = "PRON";
00152                         break;
00153                 case TYPE_PREPOSITION:
00154                         str = "PP";
00155                         break;
00156                 case TYPE_ARTICLE:
00157                         str = "DT";
00158                         break;
00159                 case TYPE_PUNCTUATION:
00160                         str = ".";
00161                         break;
00162                 }
00163                 return str;
00164         }
00165 
00169         public boolean equals( Object w ) {
00170 
00171                 if ( ! ( w instanceof Word ) )
00172                         return false;
00173 
00174                 if ( label.equalsIgnoreCase( ( (Word) w ).getLabel() ) && ( (Word) w ).getType() == type )
00175                         return true;
00176                 return false;
00177         }
00178 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


comp_ehow
Author(s): Moritz Tenorth, Daniel Nyga
autogenerated on Tue Apr 16 2013 00:18:03