Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

906 lines
29 KiB

  1. // =========================================================================
  2. // Copyright (C) 1997, Microsoft Corporation. All Rights Reserved.
  3. //
  4. // FILE NAME : BASEIRR.CPP
  5. // FUNCTION : BASE ENGINE FUNCTION COLLECTION (IRREGUL PROCESS)
  6. // : NLP Base Engine Function
  7. // =========================================================================
  8. #include "baseirr.hpp"
  9. #include "basegbl.hpp"
  10. #include "MainDict.h"
  11. //----------------------------------------------------------------------------------------------
  12. //
  13. // Function Name : NLP_Irr_01()
  14. // Parameters : char *stem :
  15. // char *ending :
  16. // Call Functions :
  17. // Description :
  18. // Return Value : Irr01_VALID :
  19. // Irr01_INVALID :
  20. // Dap_Proc :
  21. // MORECHECK :
  22. // BT :
  23. //
  24. //----------------------------------------------------------------------------------------------
  25. int BaseEngine::NLP_Irr_01( char *stem, char *ending)
  26. {
  27. char tmp[80];
  28. int temp, luls;
  29. lstrcpy (tmp, stem);
  30. luls = ULSPOS;
  31. if(__IsDefStem(luls, 1) == 1 && stem[luls-1] == __K_I && stem[luls] == __V_n)
  32. {
  33. temp = luls;
  34. __AddStem1(stem, &temp, __K_R);
  35. luls = temp;
  36. if(ACT_N_V == 1)
  37. {
  38. for (int i = 0; i < 5 ; i++)
  39. {
  40. if(strcmp(stem, INRBuf[i]) == 0)
  41. {
  42. char tstem [80];
  43. Conv.INS2HAN (stem, tstem, codeWanSeong);
  44. lstrcat (lrgsz, tstem);
  45. vbuf [wcount++] = POS_VERB;
  46. return Irr_VERB_VALID;
  47. }
  48. }
  49. if(LME == __K_B)
  50. {
  51. return INVALID;
  52. }
  53. __DelStem2(stem, &temp);
  54. luls = temp;
  55. __RepStem1(stem, luls, __K_B);
  56. if(FindIrrWord(stem, _IV_BM) & FINAL)
  57. {
  58. char tstem [80];
  59. Conv.INS2HAN (stem, tstem, codeWanSeong);
  60. lstrcat (lrgsz, tstem);
  61. vbuf [wcount++] = POS_VERB;
  62. return Irr_VERB_VALID;
  63. }
  64. if(strcmp(stem, TemDop) == 0)
  65. {
  66. char tstem [80];
  67. Conv.INS2HAN (stem, tstem, codeWanSeong);
  68. lstrcat (lrgsz, tstem);
  69. vbuf [wcount++] = POS_VERB;
  70. return Irr_VERB_VALID;
  71. }
  72. __RepStem1(stem, luls, __K_I);
  73. __AddStem2(stem, &temp, __V_n, __K_R);
  74. luls = temp;
  75. }
  76. if(ACT_P_A == 1)
  77. {
  78. for (int i = 0; i < 4; i++)
  79. {
  80. if(strcmp(stem, INRBuf2[i]) == 0)
  81. {
  82. char tstem [80];
  83. Conv.INS2HAN (stem, tstem, codeWanSeong);
  84. lstrcat (lrgsz, tstem);
  85. vbuf [wcount++] = POS_ADJECTIVE;
  86. return Irr_ADJ_VALID;
  87. }
  88. }
  89. if(LME == __K_B)
  90. {
  91. return INVALID;
  92. }
  93. __DelStem2(stem, &temp);
  94. luls = temp;
  95. __RepStem1(stem, luls, __K_B);
  96. if(FindIrrWord(stem, _RA_B) & FINAL)
  97. {
  98. return INVALID;
  99. }
  100. char tstem [80];
  101. Conv.INS2HAN (stem, tstem, codeWanSeong);
  102. if (FindSilsaWord (tstem) & _ADJECTIVE)
  103. {
  104. lstrcat (lrgsz, tstem);
  105. vbuf [wcount++] = POS_ADJECTIVE;
  106. return Irr_ADJ_VALID;
  107. }
  108. if(NLP_Dap_Proc(stem) == Dap_VALID)
  109. {
  110. return Irr_Dap_VALID;
  111. }
  112. }
  113. return BT;
  114. }
  115. if(__IsDefStem(luls, 1) == 1 && stem[luls-1] == __K_I && stem[luls] == __V_h)
  116. {
  117. if(ACT_N_V == 1)
  118. {
  119. temp = luls;
  120. __DelStem1(stem, &temp);
  121. luls = temp;
  122. __RepStem1(stem, luls, __K_B);
  123. if(FindIrrWord(stem, _IV_BP) & FINAL)
  124. {
  125. if(strcmp(stem, TemDop) == 0)
  126. {
  127. return INVALID;
  128. }
  129. char tstem [80];
  130. Conv.INS2HAN (stem, tstem, codeWanSeong);
  131. lstrcat (lrgsz, tstem);
  132. vbuf [wcount++] = POS_VERB;
  133. return Irr_VERB_VALID;
  134. }
  135. }
  136. return BT;
  137. }
  138. return MORECHECK;
  139. }
  140. //----------------------------------------------------------------------------------------------
  141. //
  142. // Function Name : NLP_Irr_KN()
  143. // Parameters : char *stem :
  144. // char *ending :
  145. // Call Functions :
  146. // Description :
  147. // Return Value :
  148. //
  149. //----------------------------------------------------------------------------------------------
  150. int BaseEngine::NLP_Irr_KN( char *stem,
  151. char *ending)
  152. {
  153. char tmp[80];
  154. int temp, luls;
  155. lstrcpy (tmp, stem);
  156. luls = ULSPOS;
  157. if(ACT_C == 1 && ACT_V == 0) // ACT_CV == 10
  158. {
  159. return INVALID;
  160. }
  161. if(strcmp(ending, TempNjRk) == 0)
  162. {
  163. return INVALID;
  164. }
  165. if (ULS >= __V_k)
  166. {
  167. temp = luls;
  168. __AddStem1(stem, &temp, __K_R);
  169. luls = temp;
  170. if(ACT_N_V == 1)
  171. {
  172. char tstem [80];
  173. Conv.INS2HAN (stem, tstem, codeWanSeong);
  174. if (FindSilsaWord (tstem) & _VERB)
  175. {
  176. lstrcat (lrgsz, tstem);
  177. vbuf [wcount++] = POS_VERB;
  178. return Irr_VERB_VALID;
  179. }
  180. }
  181. if(ACT_P_A == 1)
  182. {
  183. char tstem [80];
  184. Conv.INS2HAN (stem, tstem, codeWanSeong);
  185. if (FindSilsaWord (tstem) & _ADJECTIVE)
  186. {
  187. lstrcat (lrgsz, tstem);
  188. vbuf [wcount++] = POS_ADJECTIVE;
  189. return Irr_ADJ_VALID;
  190. }
  191. __RepStem1(stem, luls, __K_H);
  192. if(FindIrrWord(stem, _IA_HP) & FINAL ||
  193. FindIrrWord(stem, _IA_HM) & FINAL)
  194. {
  195. char tstem [80];
  196. Conv.INS2HAN (stem, tstem, codeWanSeong);
  197. lstrcat (lrgsz, tstem);
  198. vbuf [wcount++] = POS_ADJECTIVE;
  199. return Irr_ADJ_VALID;
  200. }
  201. if(__IsDefEnd(LMEPOS, 1) == 1 && __IsDefEnd(LMEPOS, 2) == 0 &&
  202. (ending[LMEPOS-1] == __V_l || ending[LMEPOS-1] == __V_k))
  203. {
  204. //-------------------------------------------------
  205. return Irr_KN_Vl;
  206. }
  207. return BT;
  208. }
  209. temp = luls;
  210. __DelStem1(stem, &temp);
  211. luls = temp;
  212. }
  213. if(__IsDefEnd(LMEPOS, 2) == 1 &&
  214. ending[LMEPOS-2] == __K_N && ending[LMEPOS-1] == __V_m)
  215. {
  216. //----------------------------------------
  217. return Irr_OPS;
  218. }
  219. return BT;
  220. }
  221. // -------------------------------------------------------------------------------------
  222. //
  223. //
  224. // -------------------------------------------------------------------------------------
  225. int BaseEngine::NLP_Irr_KN_Vl( char *stem)
  226. {
  227. char tmp[80];
  228. int temp, luls;
  229. lstrcpy (tmp, stem);
  230. luls = ULSPOS;
  231. if(__IsDefStem(luls, 1) == 1 &&
  232. stem[luls-1] == __K_I && stem[luls] == __V_n)
  233. {
  234. temp = luls;
  235. __DelStem1(stem, &temp);
  236. luls = temp;
  237. __RepStem1(stem, luls, __K_B);
  238. if(FindIrrWord(stem, _IV_BM) & FINAL)
  239. {
  240. char tstem [80];
  241. Conv.INS2HAN (stem, tstem, codeWanSeong);
  242. lstrcat (lrgsz, tstem);
  243. vbuf [wcount++] = POS_VERB;
  244. return Irr_VERB_VALID;
  245. }
  246. if(strcmp(stem, TemDop) == 0)
  247. {
  248. char tstem [80];
  249. Conv.INS2HAN (stem, tstem, codeWanSeong);
  250. lstrcat (lrgsz, tstem);
  251. vbuf [wcount++] = POS_VERB;
  252. return Irr_VERB_VALID;
  253. }
  254. if(FindIrrWord(stem, _RA_B) & FINAL)
  255. {
  256. return INVALID;
  257. }
  258. char tstem [80];
  259. Conv.INS2HAN (stem, tstem, codeWanSeong);
  260. if (FindSilsaWord (tstem) & _ADJECTIVE)
  261. {
  262. lstrcat (lrgsz, tstem);
  263. vbuf [wcount++] = POS_ADJECTIVE;
  264. return Irr_ADJ_VALID;
  265. }
  266. if(NLP_Dap_Proc(stem) < INVALID)
  267. {
  268. return Irr_Dap_VALID;
  269. }
  270. return BT;
  271. }
  272. if(__IsDefStem(luls, 1) == 1 &&
  273. stem[luls-1] == __K_I && stem[luls] == __V_h)
  274. {
  275. temp = luls;
  276. __DelStem1(stem, &temp);
  277. luls = temp;
  278. __RepStem1(stem, luls, __K_B);
  279. if(FindIrrWord(stem, _IV_BP) & FINAL)
  280. {
  281. if(strcmp(stem, TemDop) == 0)
  282. {
  283. return INVALID;
  284. }
  285. else
  286. {
  287. char tstem [80];
  288. Conv.INS2HAN (stem, tstem, codeWanSeong);
  289. lstrcat (lrgsz, tstem);
  290. vbuf [wcount++] = POS_VERB;
  291. return Irr_VERB_VALID;
  292. }
  293. }
  294. }
  295. return BT;
  296. }
  297. //----------------------------------------------------------------------------------------------
  298. //
  299. // Function Name : NLP_Machine_A()
  300. // Parameters : char *stem :
  301. // char *ending :
  302. // Call Functions :
  303. // Description :
  304. // Return Value :
  305. //
  306. //----------------------------------------------------------------------------------------------
  307. int BaseEngine::NLP_Machine_A( char *stem,
  308. char *ending)
  309. {
  310. char tmp[80];
  311. int temp, luls;
  312. lstrcpy (tmp, stem);
  313. luls = ULSPOS;
  314. temp = luls;
  315. __AddStem1(stem, &temp, __K_R);
  316. luls = temp;
  317. if(ACT_N_V == 1)
  318. {
  319. char tstem [80];
  320. Conv.INS2HAN (stem, tstem, codeWanSeong);
  321. if (FindSilsaWord (tstem) & _VERB)
  322. {
  323. lstrcat (lrgsz, tstem);
  324. vbuf [wcount++] = POS_VERB;
  325. return Irr_VERB_VALID;
  326. }
  327. }
  328. if(ACT_P_A == 1)
  329. {
  330. char tstem [80];
  331. Conv.INS2HAN (stem, tstem, codeWanSeong);
  332. if (FindSilsaWord (tstem) & _ADJECTIVE)
  333. {
  334. lstrcat (lrgsz, tstem);
  335. vbuf [wcount++] = POS_ADJECTIVE;
  336. return Irr_ADJ_VALID;
  337. }
  338. __RepStem1(stem, luls, __K_H);
  339. if(FindIrrWord(stem, _IA_HP) & FINAL ||
  340. FindIrrWord(stem, _IA_HM) & FINAL)
  341. {
  342. if (LME == __K_B)
  343. return INVALID;
  344. char tstem [80];
  345. Conv.INS2HAN (stem, tstem, codeWanSeong);
  346. lstrcat (lrgsz, tstem);
  347. vbuf [wcount++] = POS_ADJECTIVE;
  348. return Irr_ADJ_VALID;
  349. }
  350. }
  351. return BT;
  352. }
  353. //----------------------------------------------------------------------------------------------
  354. //
  355. // Function Name : NLP_Irr_KS()
  356. // Parameters : char *stem :
  357. // char *ending :
  358. // Call Functions :
  359. // Description :
  360. // Return Value :
  361. //
  362. //----------------------------------------------------------------------------------------------
  363. int BaseEngine::NLP_Irr_KS( char *stem,
  364. char *ending)
  365. {
  366. char tmp[80];
  367. int temp, luls;
  368. if (ULS >= __V_k)
  369. {
  370. lstrcpy (tmp, stem);
  371. luls = ULSPOS;
  372. temp = luls;
  373. __AddStem1(stem, &temp, __K_R);
  374. luls = temp;
  375. char tstem [80];
  376. Conv.INS2HAN (stem, tstem, codeWanSeong);
  377. if (FindSilsaWord (tstem) & _VERB)
  378. {
  379. lstrcat (lrgsz, tstem);
  380. vbuf [wcount++] = POS_VERB;
  381. return Irr_VERB_VALID;
  382. }
  383. }
  384. return BT;
  385. }
  386. // -------------------------------------------------------------------------------------
  387. //
  388. //
  389. // -------------------------------------------------------------------------------------
  390. int BaseEngine::NLP_Irr_KM( char *stem)
  391. {
  392. char tmp[80];
  393. int temp, luls;
  394. lstrcpy (tmp, stem);
  395. luls = ULSPOS;
  396. if(ACT_P_A == 1)
  397. {
  398. temp = luls;
  399. __AddStem1(stem, &temp, __K_H);
  400. luls = temp;
  401. if(FindIrrWord(stem, _IA_HP) & FINAL ||
  402. FindIrrWord(stem, _IA_HM) & FINAL)
  403. {
  404. char tstem [80];
  405. Conv.INS2HAN (stem, tstem, codeWanSeong);
  406. lstrcat (lrgsz, tstem);
  407. vbuf [wcount++] = POS_ADJECTIVE;
  408. return Irr_ADJ_VALID;
  409. }
  410. return BT;
  411. }
  412. return INVALID;
  413. }
  414. // -------------------------------------------------------------------------------------
  415. //
  416. //
  417. // -------------------------------------------------------------------------------------
  418. int BaseEngine::NLP_Irr_KRadj( char *stem,
  419. char *ending)
  420. {
  421. char tmp[80];
  422. int temp, luls;
  423. lstrcpy (tmp, stem);
  424. luls = ULSPOS;
  425. if(ending[LMEPOS-1] == __V_k)
  426. {
  427. return BT;
  428. }
  429. temp = luls;
  430. __AddStem1(stem, &temp, __K_H);
  431. luls = temp;
  432. if(FindIrrWord(stem, _IA_HP) & FINAL ||
  433. FindIrrWord(stem, _IA_HM) & FINAL)
  434. {
  435. char tstem [80];
  436. Conv.INS2HAN (stem, tstem, codeWanSeong);
  437. lstrcat (lrgsz, tstem);
  438. vbuf [wcount++] = POS_ADJECTIVE;
  439. return Irr_ADJ_VALID;
  440. }
  441. return BT;
  442. }
  443. // -------------------------------------------------------------------------------------
  444. //
  445. //
  446. // -------------------------------------------------------------------------------------
  447. int BaseEngine::NLP_Irr_KRvb( char *stem,
  448. char *ending)
  449. {
  450. char tmp[80];
  451. int temp, luls;
  452. lstrcpy (tmp, stem);
  453. luls = ULSPOS;
  454. if(ending[LMEPOS-1] == __V_j)
  455. {
  456. if(ULS == __K_R)
  457. {
  458. temp = luls;
  459. __AddStem1(stem, &temp, __V_m);
  460. luls = temp;
  461. if(FindIrrWord(stem, _IV_RmM) & FINAL)
  462. {
  463. char tstem [80];
  464. Conv.INS2HAN (stem, tstem, codeWanSeong);
  465. lstrcat (lrgsz, tstem);
  466. vbuf [wcount++] = POS_VERB;
  467. return Irr_VERB_VALID;
  468. }
  469. if(FindIrrWord(stem, _IA_RmM) & FINAL)
  470. {
  471. char tstem [80];
  472. Conv.INS2HAN (stem, tstem, codeWanSeong);
  473. lstrcat (lrgsz, tstem);
  474. vbuf [wcount++] = POS_ADJECTIVE;
  475. return Irr_ADJ_VALID;
  476. }
  477. temp = luls;
  478. __DelStem1(stem, &temp);
  479. __AddStem2(stem, &temp, __K_R, __V_m);
  480. luls = temp;
  481. if(FindIrrWord(stem, _IV_OmM) & FINAL) // (v8-)
  482. {
  483. char tstem [80];
  484. Conv.INS2HAN (stem, tstem, codeWanSeong);
  485. lstrcat (lrgsz, tstem);
  486. vbuf [wcount++] = POS_VERB;
  487. return Irr_VERB_VALID;
  488. }
  489. return BT;
  490. }
  491. if(FindIrrWord(stem, _IA_Rj) & FINAL)
  492. {
  493. char tstem [80];
  494. Conv.INS2HAN (stem, tstem, codeWanSeong);
  495. lstrcat (lrgsz, tstem);
  496. vbuf [wcount++] = POS_ADJECTIVE;
  497. return Irr_ADJ_VALID;
  498. }
  499. }
  500. else if(ending[LMEPOS-1] == __V_k)
  501. {
  502. if(ULS == __K_R)
  503. {
  504. if(__IsDefEnd(LMEPOS, 2) == 0 ||
  505. (__IsDefEnd(LMEPOS, 3) == 1 &&
  506. ending[LMEPOS-3] == __V_h && ending[LMEPOS-2] == __K_D) ||
  507. (__IsDefEnd(LMEPOS, 3) == 1 &&
  508. ending[LMEPOS-3] == __V_i && ending[LMEPOS-2] == __K_I))
  509. {
  510. temp = luls;
  511. __AddStem1(stem, &temp, __V_m);
  512. luls = temp;
  513. if(FindIrrWord(stem, _IV_RmP) & FINAL)
  514. {
  515. char tstem [80];
  516. Conv.INS2HAN (stem, tstem, codeWanSeong);
  517. lstrcat (lrgsz, tstem);
  518. vbuf [wcount++] = POS_VERB;
  519. return Irr_VERB_VALID;
  520. }
  521. if(FindIrrWord(stem, _IA_RmP) & FINAL)
  522. {
  523. char tstem [80];
  524. Conv.INS2HAN (stem, tstem, codeWanSeong);
  525. lstrcat (lrgsz, tstem);
  526. vbuf [wcount++] = POS_ADJECTIVE;
  527. return Irr_ADJ_VALID;
  528. }
  529. return BT;
  530. }
  531. }
  532. if(__IsDefEnd(LMEPOS, 2) == 0 ||
  533. (__IsDefEnd(LMEPOS, 3) == 1 &&
  534. ending[LMEPOS-3] == __V_h && ending[LMEPOS-2] == __K_D))
  535. {
  536. return SS;
  537. }
  538. }
  539. return BT;
  540. }
  541. // -------------------------------------------------------------------------------------
  542. //
  543. //
  544. // -------------------------------------------------------------------------------------
  545. int BaseEngine::NLP_Irr_KI_KR( char *stem,
  546. char *ending)
  547. {
  548. char tmp[80];
  549. int luls;
  550. lstrcpy (tmp, stem);
  551. luls = ULSPOS;
  552. if(ACT_N_V == 1)
  553. {
  554. __RepStem1(stem, ULSPOS, __K_D);
  555. if(ending[LMEPOS-1] == __V_j)
  556. {
  557. if(FindIrrWord(stem, _IV_DM) & FINAL)
  558. {
  559. char tstem [80];
  560. Conv.INS2HAN (stem, tstem, codeWanSeong);
  561. lstrcat (lrgsz, tstem);
  562. vbuf [wcount++] = POS_VERB;
  563. return Irr_VERB_VALID;
  564. }
  565. return BT;
  566. }
  567. if(ending[LMEPOS-1] == __V_k)
  568. {
  569. if(FindIrrWord(stem, _IV_DP) & FINAL)
  570. {
  571. char tstem [80];
  572. Conv.INS2HAN (stem, tstem, codeWanSeong);
  573. lstrcat (lrgsz, tstem);
  574. vbuf [wcount++] = POS_VERB;
  575. return Irr_VERB_VALID;
  576. }
  577. return BT;
  578. }
  579. if(FindIrrWord(stem, _IV_DP) & FINAL ||
  580. FindIrrWord(stem, _IV_DM) & FINAL)
  581. {
  582. char tstem [80];
  583. Conv.INS2HAN (stem, tstem, codeWanSeong);
  584. lstrcat (lrgsz, tstem);
  585. vbuf [wcount++] = POS_VERB;
  586. return Irr_VERB_VALID;
  587. }
  588. }
  589. return BT;
  590. }
  591. // -------------------------------------------------------------------------------------
  592. //
  593. //
  594. // -------------------------------------------------------------------------------------
  595. int BaseEngine::NLP_Irr_KI_V( char *stem,
  596. char *ending)
  597. {
  598. char tmp[80];
  599. int temp, luls;
  600. lstrcpy (tmp, stem);
  601. luls = ULSPOS;
  602. if(ACT_N_V == 1)
  603. {
  604. temp = luls;
  605. __AddStem1(stem, &temp, __K_S);
  606. luls = temp;
  607. if(ending[LMEPOS-1] == __V_j)
  608. {
  609. if(FindIrrWord(stem, _IV_SM) & FINAL)
  610. {
  611. char tstem [80];
  612. Conv.INS2HAN (stem, tstem, codeWanSeong);
  613. lstrcat (lrgsz, tstem);
  614. vbuf [wcount++] = POS_VERB;
  615. return Irr_VERB_VALID;
  616. }
  617. return BT;
  618. }
  619. if(ending[LMEPOS-1] == __V_k)
  620. {
  621. if(FindIrrWord(stem, _IV_SP) & FINAL)
  622. {
  623. char tstem [80];
  624. Conv.INS2HAN (stem, tstem, codeWanSeong);
  625. lstrcat (lrgsz, tstem);
  626. vbuf [wcount++] = POS_VERB;
  627. return Irr_VERB_VALID;
  628. }
  629. temp = luls;
  630. __DelStem1(stem, &temp);
  631. __AddStem2(stem, &temp, __K_I, __V_m);
  632. luls = temp;
  633. if(FindIrrWord(stem, _IV_OmP) & FINAL)
  634. {
  635. char tstem [80];
  636. Conv.INS2HAN (stem, tstem, codeWanSeong);
  637. lstrcat (lrgsz, tstem);
  638. vbuf [wcount++] = POS_VERB;
  639. return Irr_VERB_VALID; //v8+
  640. }
  641. return BT;
  642. }
  643. if(FindIrrWord(stem, _IV_SP) & FINAL ||
  644. FindIrrWord(stem, _IV_SM) & FINAL)
  645. {
  646. char tstem [80];
  647. Conv.INS2HAN (stem, tstem, codeWanSeong);
  648. lstrcat (lrgsz, tstem);
  649. vbuf [wcount++] = POS_VERB;
  650. return Irr_VERB_VALID;
  651. }
  652. }
  653. if(__IsDefEnd(LMEPOS, 1) == 1 && ending[LMEPOS-1] == __V_m)
  654. {
  655. if(strcmp(stem, TempNa) == 0)
  656. {
  657. char tstem [80];
  658. Conv.INS2HAN (stem, tstem, codeWanSeong);
  659. lstrcat (lrgsz, tstem);
  660. vbuf [wcount++] = POS_ADJECTIVE;
  661. return Irr_ADJ_VALID;
  662. }
  663. }
  664. return BT;
  665. }
  666. // -------------------------------------------------------------------------------------
  667. //
  668. //
  669. // -------------------------------------------------------------------------------------
  670. //----------------------------------------------------------------------------------------------
  671. //
  672. // Function Name : NLP_Irr_OPS()
  673. // Parameters : char *stem :
  674. // char *ending :
  675. // Summary :
  676. // Call Functions :
  677. // Description :
  678. // Return Value :
  679. //
  680. //----------------------------------------------------------------------------------------------
  681. int BaseEngine::NLP_Irr_OPS(char *stem,
  682. char *ending)
  683. {
  684. char tmp[80];
  685. int res, luls;
  686. lstrcpy (tmp, stem);
  687. luls = ULSPOS;
  688. if(__IsDefEnd(LMEPOS, 3) == 0) // nx3 == null
  689. {
  690. if(__IsDefStem(luls, 3) == 1 &&
  691. stem[luls] == __K_S && stem[luls-1] == __K_B &&
  692. stem[luls-2] == __V_j && stem[luls-3] == __K_I )
  693. {
  694. if(FindIrrWord(stem, _YOP) & FINAL)
  695. {
  696. char tstem [80];
  697. Conv.INS2HAN (stem, tstem, codeWanSeong);
  698. lstrcat (lrgsz, tstem);
  699. vbuf [wcount++] = POS_ADJECTIVE;
  700. return Irr_ADJ_VALID;
  701. }
  702. }
  703. if(__IsDefStem(luls, 2) == 1 &&
  704. stem[luls] == __K_S_D && stem[luls-1] == __V_l && stem[luls-2] == __K_I )
  705. {
  706. if(FindIrrWord(stem, _ISS) & FINAL)
  707. {
  708. char tstem [80];
  709. Conv.INS2HAN (stem, tstem, codeWanSeong);
  710. lstrcat (lrgsz, tstem);
  711. vbuf [wcount++] = POS_ADJECTIVE;
  712. return Irr_ADJ_VALID;
  713. }
  714. if((res = NLP_AUX_Find(stem, 1)) < INVALID)
  715. {
  716. return res + Irr_AUX;
  717. }
  718. }
  719. if(__IsDefStem(luls, 1) == 1 && ULS == __V_o && stem[luls-1] == __K_H)
  720. {
  721. return INVALID;
  722. }
  723. if(ULS == __V_hk || ULS == __V_ho)
  724. {
  725. return INVALID;
  726. }
  727. char tstem [80];
  728. Conv.INS2HAN (stem, tstem, codeWanSeong);
  729. if (FindSilsaWord (tstem) & _ADJECTIVE)
  730. {
  731. return INVALID;
  732. }
  733. return SS;
  734. }
  735. if(ending[LMEPOS-3] >= __V_k ||
  736. ending[LMEPOS-3] == __K_J ||
  737. ending[LMEPOS-3] == __K_B ||
  738. (__IsDefEnd(LMEPOS, 4) == 1 &&
  739. ending[LMEPOS-3] == __K_D && ending[LMEPOS-4] == __V_p) ||
  740. (__IsDefEnd(LMEPOS, 3) == 1 &&
  741. ending[LMEPOS-3] == __K_G))
  742. {
  743. if(__IsDefStem(luls, 3) == 1 &&
  744. stem[luls] == __K_S && stem[luls-1] == __K_B &&
  745. stem[luls-2] == __V_j && stem[luls-3] == __K_I )
  746. {
  747. if(FindIrrWord(stem, _YOP) & FINAL)
  748. {
  749. char tstem [80];
  750. Conv.INS2HAN (stem, tstem, codeWanSeong);
  751. lstrcat (lrgsz, tstem);
  752. vbuf [wcount++] = POS_ADJECTIVE;
  753. return Irr_ADJ_VALID;
  754. }
  755. }
  756. // if(__IsDefStem(luls, 3) == 1 &&
  757. if(__IsDefStem(luls, 2) == 1 &&
  758. stem[luls] == __K_S_D && stem[luls-1] == __V_l && stem[luls-2] == __K_I )
  759. {
  760. if(FindIrrWord(stem, _ISS) & FINAL)
  761. {
  762. char tstem [80];
  763. Conv.INS2HAN (stem, tstem, codeWanSeong);
  764. lstrcat (lrgsz, tstem);
  765. vbuf [wcount++] = POS_ADJECTIVE;
  766. return Irr_ADJ_VALID;
  767. }
  768. if((res = NLP_AUX_Find(stem, 1)) < INVALID)
  769. {
  770. return res + Irr_AUX;
  771. }
  772. }
  773. }
  774. return BT;
  775. }
  776. //----------------------------------------------------------------------------------------------
  777. //
  778. // Function Name : NLP_Irr_KI()
  779. // Parameters : char *stem :
  780. // char *ending :
  781. // Summary : IEUNG Irregular
  782. // Call Functions :
  783. // Description :
  784. // Return Value :
  785. //
  786. //----------------------------------------------------------------------------------------------
  787. int BaseEngine::NLP_Irr_KI(char *stem,
  788. char *ending)
  789. {
  790. char tmp[80], tmpstem [80], tmpending [40];
  791. int res, temp, luls;
  792. lstrcpy (tmp, stem);
  793. luls = ULSPOS;
  794. temp = luls;
  795. __AddStem1(stem, &temp, __K_R); // add "RIEUL" to stem
  796. luls = temp;
  797. if(ACT_N_V == 1)
  798. {
  799. Conv.INS2HAN (stem, tmpstem, codeWanSeong);
  800. if (FindSilsaWord (tmpstem) & _VERB)
  801. {
  802. lstrcat (lrgsz, tmpstem);
  803. vbuf [wcount++] = POS_VERB;
  804. lstrcat (lrgsz, "+");
  805. Conv.INR2HAN (ending, tmpending, codeWanSeong);
  806. lstrcat (lrgsz, tmpending);
  807. vbuf [wcount++] = POS_ENDING;
  808. lstrcat (lrgsz, "\t");
  809. return Irr_VERB_VALID;
  810. }
  811. }
  812. if(ACT_P_A == 1)
  813. {
  814. Conv.INS2HAN (stem, tmpstem, codeWanSeong);
  815. if (FindSilsaWord (tmpstem) & _ADJECTIVE)
  816. {
  817. lstrcat (lrgsz, tmpstem);
  818. vbuf [wcount++] = POS_ADJECTIVE;
  819. lstrcat (lrgsz, "+");
  820. Conv.INR2HAN (ending, tmpending, codeWanSeong);
  821. lstrcat (lrgsz, tmpending);
  822. vbuf [wcount++] = POS_ENDING;
  823. lstrcat (lrgsz, "\t");
  824. return Irr_ADJ_VALID;
  825. }
  826. __RepStem1(stem, luls, __K_H); // "RIEUL" > "HIEUH"
  827. if(FindIrrWord(stem, _IA_HP) & FINAL || // HIEUH irregular positive & _ADJECTIVE (A5+)
  828. FindIrrWord(stem, _IA_HM) & FINAL) // HIEUH irregular negative & _ADJECTIVE (A5-)
  829. {
  830. Conv.INS2HAN (stem, tmpstem, codeWanSeong);
  831. lstrcat (lrgsz, tmpstem);
  832. vbuf [wcount++] = POS_ADJECTIVE;
  833. lstrcat (lrgsz, "+");
  834. Conv.INR2HAN (ending, tmpending, codeWanSeong);
  835. lstrcat (lrgsz, tmpending);
  836. vbuf [wcount++] = POS_ENDING;
  837. lstrcat (lrgsz, "\t");
  838. return Irr_ADJ_VALID;
  839. }
  840. }
  841. if(ACT_N_V == 1)
  842. {
  843. if((res = NLP_AUX_Find(stem, 0)) < INVALID)
  844. {
  845. lstrcat (lrgsz, "+");
  846. Conv.INR2HAN (ending, tmpending, codeWanSeong);
  847. lstrcat (lrgsz, tmpending);
  848. vbuf [wcount++] = POS_ENDING;
  849. lstrcat (lrgsz, "\t");
  850. return res + Irr_AUX;
  851. }
  852. }
  853. return BT;
  854. }