| | 123 | |
|---|
| | 124 | public void testMorphemeGeneration() throws Exception |
|---|
| | 125 | { |
|---|
| | 126 | StringBuffer hebrewText = new StringBuffer(); |
|---|
| | 127 | List<String[]> columns = new ArrayList<String[]>(); |
|---|
| | 128 | |
|---|
| | 129 | Sheaf sheaf = m_Emdros.getSheaf |
|---|
| | 130 | ( |
|---|
| | 131 | "SELECT ALL OBJECTS IN " + |
|---|
| | 132 | "{" + m_Emdros.getMinM() + "-" + m_Emdros.getMaxM() + "} " + |
|---|
| | 133 | "WHERE [clause self = 28951 " + // Gen 2,24(b) |
|---|
| | 134 | " GET logical_struct_id, logical_structure "+ |
|---|
| | 135 | " [phrase GET phrase_type, phrase_function, argument_name, "+ |
|---|
| | 136 | " type_id, macrorole_number "+ |
|---|
| | 137 | " [word GET lexeme, phrase_dependent_part_of_speech, " + |
|---|
| | 138 | " tense, stem, wordnet_gloss, wordnet_synset, " + |
|---|
| | 139 | " graphical_preformative, " + |
|---|
| | 140 | " graphical_locative, " + |
|---|
| | 141 | " graphical_lexeme, " + |
|---|
| | 142 | " graphical_pron_suffix, " + |
|---|
| | 143 | " graphical_verbal_ending, " + |
|---|
| | 144 | " graphical_root_formation, " + |
|---|
| | 145 | " graphical_nominal_ending, " + |
|---|
| | 146 | " person, number, gender, state, " + |
|---|
| | 147 | " surface_consonants, " + |
|---|
| | 148 | " suffix_person, suffix_number, suffix_gender " + |
|---|
| | 149 | " ]"+ |
|---|
| | 150 | " ]"+ |
|---|
| | 151 | " ]" |
|---|
| | 152 | ); |
|---|
| | 153 | |
|---|
| | 154 | MatchedObject clause = null; |
|---|
| | 155 | SheafConstIterator sci = sheaf.const_iterator(); |
|---|
| | 156 | if (sci.hasNext()) |
|---|
| | 157 | { |
|---|
| | 158 | Straw straw = sci.next(); |
|---|
| | 159 | StrawConstIterator swci = straw.const_iterator(); |
|---|
| | 160 | if (swci.hasNext()) |
|---|
| | 161 | { |
|---|
| | 162 | clause = swci.next(); |
|---|
| | 163 | } |
|---|
| | 164 | } |
|---|
| | 165 | |
|---|
| | 166 | SheafConstIterator phrases = clause.getSheaf().const_iterator(); |
|---|
| | 167 | List<MorphEdge> morphEdges = new ArrayList<MorphEdge>(); |
|---|
| | 168 | boolean isFirstWord = true; |
|---|
| | 169 | HebrewMorphemeGenerator generator = new HebrewMorphemeGenerator(); |
|---|
| | 170 | |
|---|
| | 171 | while (phrases.hasNext()) |
|---|
| | 172 | { |
|---|
| | 173 | MatchedObject phrase = |
|---|
| | 174 | phrases.next().const_iterator().next(); |
|---|
| | 175 | |
|---|
| | 176 | SheafConstIterator words = phrase.getSheaf().const_iterator(); |
|---|
| | 177 | |
|---|
| | 178 | while (words.hasNext()) |
|---|
| | 179 | { |
|---|
| | 180 | MatchedObject word = words.next().const_iterator().next(); |
|---|
| | 181 | |
|---|
| | 182 | HebrewGlossTableGeneratingMorphemeHandler hmh = |
|---|
| | 183 | new HebrewGlossTableGeneratingMorphemeHandler( |
|---|
| | 184 | columns, word, hebrewText, |
|---|
| | 185 | morphEdges, isFirstWord, |
|---|
| | 186 | !phrases.hasNext() && !words.hasNext()); |
|---|
| | 187 | |
|---|
| | 188 | generator.parse(word, hmh, true, m_SQL); |
|---|
| | 189 | } |
|---|
| | 190 | } |
|---|
| | 191 | |
|---|
| | 192 | assertEquals("CONJ", morphEdges.get(0).symbol()); |
|---|
| | 193 | assertEquals("V/TAM", morphEdges.get(1).symbol()); |
|---|
| | 194 | assertEquals("V/STM", morphEdges.get(2).symbol()); |
|---|
| | 195 | assertEquals("V/NUC", morphEdges.get(3).symbol()); |
|---|
| | 196 | assertEquals("AG/PSA", morphEdges.get(4).symbol()); |
|---|
| | 197 | assertEquals("PRON/DCA", morphEdges.get(5).symbol()); |
|---|
| | 198 | assertEquals("P", morphEdges.get(6).symbol()); |
|---|
| | 199 | assertEquals("N/NUC", morphEdges.get(7).symbol()); |
|---|
| | 200 | assertEquals("N/PNS", morphEdges.get(8).symbol()); |
|---|
| | 201 | assertEquals("N/POS", morphEdges.get(9).symbol()); |
|---|
| | 202 | } |
|---|