Changeset 80
- Timestamp:
- 02/06/07 21:49:55 (2 years ago)
- Files:
-
- lex/trunk/jsp/clause.jsp (modified) (4 diffs)
- lex/trunk/jsp/parse.jsp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lex/trunk/jsp/clause.jsp
r78 r80 6 6 <%@ page import="com.qwirx.lex.wordnet.*" %> 7 7 <%@ page import="com.qwirx.lex.parser.*" %> 8 <%@ page import="com.qwirx.lex.morph.*" %> 8 9 <%@ page import="net.didion.jwnl.data.POS" %> 9 10 <%@ page import="net.didion.jwnl.data.Synset" %> … … 89 90 90 91 Map verbal_stems = emdros.getEnumerationConstants 91 ("verbal_stem_t",false);92 93 Map persons = emdros.getEnumerationConstants94 ("person_t",false);95 96 Map numbers = emdros.getEnumerationConstants97 ("number_t",false);98 99 Map genders = emdros.getEnumerationConstants100 ("gender_t",false);101 102 Map states = emdros.getEnumerationConstants103 ("state_t",false);104 105 Map tenses = emdros.getEnumerationConstants106 ("verbal_tense_t",false);107 108 Map stems = emdros.getEnumerationConstants109 92 ("verbal_stem_t",false); 110 93 … … 218 201 ); 219 202 220 class HebrewFeatureConverter 203 class HebrewFeatureConverter implements MorphemeHandler 221 204 { 222 205 private TreeNode m_root; … … 262 245 morphEdges); 263 246 264 String person = (String)persons.get( 265 word.getEMdFValue("person").toString()); 266 if (person.equals("pers_first")) person = "1"; 267 else if (person.equals("pers_second")) person = "2"; 268 else if (person.equals("pers_third")) person = "3"; 269 270 String gender = ((String)genders.get( 271 word.getEMdFValue("gender").toString() 272 )).substring(0, 1); 273 274 String number = ((String)numbers.get( 275 word.getEMdFValue("number").toString() 276 )).substring(0, 1); 277 278 String state = (String)states.get( 279 word.getEMdFValue("state").toString()); 280 281 String gloss = word.getEMdFValue("wordnet_gloss") 282 .getString(); 283 284 if (gloss.equals("")) 285 { 286 String lexeme = word.getEMdFValue("lexeme") 287 .getString(); 288 289 OntologyDb.OntologyEntry entry = 290 ontology.getWordByLexeme(lexeme); 291 292 if (entry != null) 293 { 294 gloss = entry.m_EnglishGloss; 295 } 296 else 297 { 298 gloss = null; 299 } 300 } 301 302 if (psp.equals("verb")) 303 { 304 hfc.convert("graphical_preformative", false, 305 (String)tenses.get(word 306 .getEMdFValue("verbal_tense").toString()), 307 "V/TNS"); 308 hfc.convert("graphical_root_formation", false, 309 (String)stems.get(word 310 .getEMdFValue("verbal_stem").toString()), 311 "V/STM"); 312 hfc.convert("graphical_lexeme", false, gloss, 313 "V/LEX"); 314 hfc.convert("graphical_verbal_ending", true, 315 person + gender + number, "V/PGN"); 316 } 317 else if (psp.equals("noun") 318 || psp.equals("proper_noun")) 319 { 320 String type = "HEAD/NCOM"; 321 322 if (psp.equals("proper_noun")) 323 { 324 type = "HEAD/NPROP"; 325 } 326 327 hfc.convert("graphical_lexeme", false, gloss, type); 328 hfc.convert("graphical_nominal_ending", true, 329 gender + number + "." + state, "MARK/N"); 330 } 331 else 332 { 333 String type; 334 335 if (psp.equals("adjective")) 336 { 337 type = "ADJ"; 338 } 339 else if (psp.equals("adverb")) 340 { 341 type = "ADV"; 342 } 343 else if (psp.equals("article")) 344 { 345 type = "DET"; 346 } 347 else if (psp.equals("conjunction")) 348 { 349 type = "CONJ"; 350 } 351 else if (psp.equals("demonstrative_pronoun")) 352 { 353 type = "PRON/DEM"; 354 } 355 else if (psp.equals("interjection")) 356 { 357 type = "INTJ"; 358 } 359 else if (psp.equals("interrogative")) 360 { 361 type = "INTR"; 362 } 363 else if (psp.equals("interrogative_pronoun")) 364 { 365 type = "PRON/INT"; 366 } 367 else if (psp.equals("negative")) 368 { 369 type = "NEG"; 370 } 371 else if (psp.equals("personal_pronoun")) 372 { 373 type = "PRON/PERS"; 374 } 375 else if (psp.equals("preposition")) 376 { 377 type = "P"; 378 } 379 else 380 { 381 throw new IllegalArgumentException("Unknown " + 382 "part of speech: " + psp); 383 } 384 385 hfc.convert("graphical_lexeme", true, psp, type); 386 } 387 247 HebrewMorphemeGenerator gen = 248 new HebrewMorphemeGenerator(emdros, hfc); 249 gen.parse(word); 250 388 251 hebrewText.append(" "); 389 252 lex/trunk/jsp/parse.jsp
r74 r80 3 3 <%@ page import="com.qwirx.lex.wordnet.*" %> 4 4 <%@ page import="com.qwirx.lex.parser.*" %> 5 <%@ page import="com.qwirx.lex.morph.*" %> 5 6 6 7 <html> … … 253 254 ("phrase_type_t",false); 254 255 255 Map parts_of_speech = emdros.getEnumerationConstants256 ("psp_t",false);257 258 256 Map verbal_stems = emdros.getEnumerationConstants 259 ("verbal_stem_t",false);260 261 Map persons = emdros.getEnumerationConstants262 ("person_t",false);263 264 Map numbers = emdros.getEnumerationConstants265 ("number_t",false);266 267 Map genders = emdros.getEnumerationConstants268 ("gender_t",false);269 270 Map states = emdros.getEnumerationConstants271 ("state_t",false);272 273 Map tenses = emdros.getEnumerationConstants274 ("verbal_tense_t",false);275 276 Map stems = emdros.getEnumerationConstants277 257 ("verbal_stem_t",false); 278 258 … … 360 340 MatchedObject word = words.next().const_iterator().next(); 361 341 362 String psp = (String)( parts_of_speech.get( 363 word.getEMdFValue("pdpsp").toString()) 364 ); 365 366 class HebrewFeatureConverter 342 class HebrewFeatureConverter implements MorphemeHandler 367 343 { 368 344 private TreeNode m_root; … … 408 384 morphEdges); 409 385 410 String person = (String)persons.get( 411 word.getEMdFValue("person").toString()); 412 if (person.equals("pers_first")) person = "1"; 413 else if (person.equals("pers_second")) person = "2"; 414 else if (person.equals("pers_third")) person = "3"; 415 416 String gender = ((String)genders.get( 417 word.getEMdFValue("gender").toString() 418 )).substring(0, 1); 419 420 String number = ((String)numbers.get( 421 word.getEMdFValue("number").toString() 422 )).substring(0, 1); 423 424 String state = (String)states.get( 425 word.getEMdFValue("state").toString()); 426 427 String gloss = word.getEMdFValue("wordnet_gloss") 428 .getString(); 429 430 if (gloss.equals("")) 431 { 432 String lexeme = word.getEMdFValue("lexeme") 433 .getString(); 434 435 OntologyDb.OntologyEntry entry = 436 ontology.getWordByLexeme(lexeme); 437 438 if (entry != null) 439 { 440 gloss = entry.m_EnglishGloss; 441 } 442 else 443 { 444 gloss = null; 445 } 446 } 447 448 if (psp.equals("verb")) 449 { 450 hfc.convert("graphical_preformative", false, 451 (String)tenses.get(word 452 .getEMdFValue("verbal_tense").toString()), 453 "V/TNS"); 454 hfc.convert("graphical_root_formation", false, 455 (String)stems.get(word 456 .getEMdFValue("verbal_stem").toString()), 457 "V/STM"); 458 hfc.convert("graphical_lexeme", false, gloss, 459 "V/LEX"); 460 hfc.convert("graphical_verbal_ending", true, 461 person + gender + number, "V/PGN"); 462 } 463 else if (psp.equals("noun") 464 || psp.equals("proper_noun")) 465 { 466 String type = "HEAD/NCOM"; 467 468 if (psp.equals("proper_noun")) 469 { 470 type = "HEAD/NPROP"; 471 } 472 473 hfc.convert("graphical_lexeme", false, gloss, type); 474 hfc.convert("graphical_nominal_ending", true, 475 gender + number + "." + state, "MARK/N"); 476 } 477 else 478 { 479 String type; 480 481 if (psp.equals("adjective")) 482 { 483 type = "ADJ"; 484 } 485 else if (psp.equals("adverb")) 486 { 487 type = "ADV"; 488 } 489 else if (psp.equals("article")) 490 { 491 type = "DET"; 492 } 493 else if (psp.equals("conjunction")) 494 { 495 type = "CONJ"; 496 } 497 else if (psp.equals("demonstrative_pronoun")) 498 { 499 type = "PRON/DEM"; 500 } 501 else if (psp.equals("interjection")) 502 { 503 type = "INTJ"; 504 } 505 else if (psp.equals("interrogative")) 506 { 507 type = "INTR"; 508 } 509 else if (psp.equals("interrogative_pronoun")) 510 { 511 type = "PRON/INT"; 512 } 513 else if (psp.equals("negative")) 514 { 515 type = "NEG"; 516 } 517 else if (psp.equals("personal_pronoun")) 518 { 519 type = "PRON/PERS"; 520 } 521 else if (psp.equals("preposition")) 522 { 523 type = "P"; 524 } 525 else 526 { 527 throw new IllegalArgumentException("Unknown " + 528 "part of speech: " + psp); 529 } 530 531 hfc.convert("graphical_lexeme", true, psp, type); 532 } 386 HebrewMorphemeGenerator gen = 387 new HebrewMorphemeGenerator(emdros, hfc); 388 gen.parse(word); 533 389 534 390 hebrewText.append(" ");
