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.

852 lines
26 KiB

  1. // =========================================================================
  2. // Copyright (C) 1997, Microsoft Corporation. All Rights Reserved.
  3. //
  4. // FILE NAME : BASEVSUB.CPP
  5. // Function : BASE ENGINE FUNCTION COLLECTION (VERB PROCESS)
  6. // : NLP Base Engine Function
  7. // =========================================================================
  8. #include "basevsub.hpp"
  9. #include "basegbl.hpp"
  10. #include "MainDict.h"
  11. // ----------------------------------------------------------------------
  12. //
  13. //
  14. // ----------------------------------------------------------------------
  15. int BaseEngine::NLP_KTC_Proc(char *stem, char *ending)
  16. {
  17. char tmpstem[80], tmpending [80], tmpstring [80];
  18. int temp;
  19. temp = ULSPOS;
  20. lstrcpy(tmpstem, stem);
  21. __AddStem2(tmpstem, &temp, __K_H, __V_k);
  22. lstrcpy (tmpending, ending);
  23. int len = lstrlen(tmpending) - 1;
  24. switch (tmpending [len]) // inserted by dhyu 1996.2
  25. {
  26. case __K_K : tmpending [len] = __K_G; break;
  27. case __K_T : tmpending [len] = __K_D; break;
  28. case __K_C : tmpending [len] = __K_J; break;
  29. }
  30. Conv.INS2HAN (tmpstem, tmpstring, codeWanSeong);
  31. if (FindSilsaWord (tmpstring) & _VERB)
  32. {
  33. lstrcat (lrgsz, tmpstring);
  34. vbuf [wcount++] = POS_VERB;
  35. lstrcat (lrgsz, "+");
  36. Conv.INR2HAN (tmpending, tmpstring, codeWanSeong);
  37. lstrcat (lrgsz, tmpstring);
  38. vbuf [wcount++] = POS_ENDING;
  39. lstrcat (lrgsz, "\t");
  40. return KTC_VERB_VALID;
  41. }
  42. if(ACT_P_A == 1)
  43. {
  44. Conv.INS2HAN (tmpstem, tmpstring, codeWanSeong);
  45. if (FindSilsaWord (tmpstring) & _ADJECTIVE)
  46. {
  47. lstrcat (lrgsz, tmpstring);
  48. vbuf [wcount++] = POS_ADJECTIVE;
  49. lstrcat (lrgsz, "+");
  50. Conv.INR2HAN (tmpending, tmpstring, codeWanSeong);
  51. lstrcat (lrgsz, tmpstring);
  52. vbuf [wcount++] = POS_ENDING;
  53. lstrcat (lrgsz, "\t");
  54. return KTC_ADJ_VALID;
  55. }
  56. else
  57. {
  58. return BT;
  59. }
  60. }
  61. return INVALID;
  62. }
  63. // ----------------------------------------------------------------------
  64. //
  65. //
  66. // modified by dhyu 1996.2
  67. // ----------------------------------------------------------------------
  68. int BaseEngine::NLP_Machine_T(char *stem,
  69. char *ending)
  70. {
  71. char bending[80],
  72. index[1],
  73. tmpstem[80],
  74. tmpstring [80];
  75. int ret, ulspos;
  76. memset(bending, NULL, 80);
  77. lstrcpy(tmpstem, stem);
  78. ulspos = lstrlen(tmpstem)-1;
  79. int B_index = B_Dict.FindWord(tmpstem, ulspos);
  80. if(B_index != -1)
  81. { // if the rear of stem is 'BBUN'
  82. if(ulspos == -1) // if the whole stem is only 'BBUN'
  83. {
  84. Conv.INS2HAN (stem, tmpstring, codeWanSeong);
  85. lstrcat (lrgsz, tmpstring);
  86. vbuf [wcount++] = POS_NOUN;
  87. lstrcat (lrgsz, "+");
  88. lstrcat (lrgsz, Ieung_I);
  89. vbuf [wcount++] = POS_OTHERS | COPULA_OTHERS;
  90. return NOUN_VALID;
  91. }
  92. index[0] = 'm';
  93. Conv.INS2HAN (tmpstem, tmpstring, codeWanSeong);
  94. if (FindSilsaWord (tmpstring) & _NOUN)
  95. {
  96. lstrcat (lrgsz, tmpstring);
  97. vbuf [wcount++] = POS_NOUN;
  98. lstrcat (lrgsz, "+");
  99. lstrcat (lrgsz, SangP_U_N);
  100. vbuf [wcount++] = POS_TOSSI;
  101. lstrcat (lrgsz, "+");
  102. lstrcat (lrgsz, Ieung_I);
  103. vbuf [wcount++] = POS_OTHERS | COPULA_OTHERS;
  104. return NOUN_VALID;
  105. }
  106. if((ret = NLP_Fix_Proc(tmpstem, ending)) < INVALID)
  107. {
  108. lstrcat (lrgsz, "+");
  109. lstrcat (lrgsz, SangP_U_N);
  110. vbuf [wcount++] = POS_TOSSI;
  111. lstrcat (lrgsz, "+");
  112. lstrcat (lrgsz, Ieung_I);
  113. vbuf [wcount++] = POS_OTHERS | COPULA_OTHERS;
  114. return ret;
  115. }
  116. if(FindIrrWord(tmpstem, _ZPN) & FINAL) // Pronoun
  117. {
  118. Conv.INS2HAN (tmpstem, tmpstring, codeWanSeong);
  119. lstrcat (lrgsz, tmpstring);
  120. vbuf [wcount++] = POS_PRONOUN;
  121. lstrcat (lrgsz, "+");
  122. lstrcat (lrgsz, SangP_U_N);
  123. vbuf [wcount++] = POS_TOSSI;
  124. lstrcat (lrgsz, "+");
  125. lstrcat (lrgsz, Ieung_I);
  126. vbuf [wcount++] = POS_OTHERS | COPULA_OTHERS;
  127. return PRON_VALID;
  128. }
  129. if(NLP_Num_Proc(tmpstem) < INVALID)
  130. {
  131. Conv.INS2HAN (tmpstem, tmpstring, codeWanSeong);
  132. lstrcat (lrgsz, tmpstring);
  133. vbuf [wcount++] = POS_NUMBER;
  134. lstrcat (lrgsz, "+");
  135. lstrcat (lrgsz, SangP_U_N);
  136. vbuf [wcount++] = POS_TOSSI;
  137. lstrcat (lrgsz, "+");
  138. lstrcat (lrgsz, Ieung_I);
  139. vbuf [wcount++] = POS_OTHERS | COPULA_OTHERS;
  140. return NUM_VALID;
  141. }
  142. // hjw : 95/3/176
  143. if(tmpstem[ulspos] == __K_R)
  144. {
  145. return INVALID;
  146. }
  147. return MORECHECK;
  148. }
  149. int T_index = T_Dict.FindWord(tmpstem, ulspos);
  150. index[0] = 'm';
  151. Conv.INS2HAN (tmpstem, tmpstring, codeWanSeong);
  152. if (FindSilsaWord (tmpstring) & _NOUN)
  153. {
  154. lstrcat (lrgsz, tmpstring);
  155. vbuf [wcount++] = POS_NOUN;
  156. lstrcat (lrgsz, "+");
  157. lstrcat (lrgsz, Ieung_I);
  158. vbuf [wcount++] = POS_OTHERS | COPULA_OTHERS;
  159. return NOUN_VALID;
  160. }
  161. if((ret = NLP_Fix_Proc(tmpstem, ending)) < INVALID)
  162. {
  163. return ret;
  164. }
  165. if(FindIrrWord(tmpstem, _ZPN) & FINAL)
  166. {
  167. Conv.INS2HAN (tmpstem, tmpstring, codeWanSeong);
  168. lstrcat (lrgsz, tmpstring);
  169. vbuf [wcount++] = POS_PRONOUN;
  170. lstrcat (lrgsz, "+");
  171. lstrcat (lrgsz, Ieung_I);
  172. vbuf [wcount++] = POS_OTHERS | COPULA_OTHERS;
  173. return PRON_VALID;
  174. }
  175. if(NLP_Num_Proc(tmpstem) < INVALID)
  176. {
  177. Conv.INS2HAN (tmpstem, tmpstring, codeWanSeong);
  178. lstrcat (lrgsz, tmpstring);
  179. vbuf [wcount++] = POS_NUMBER;
  180. lstrcat (lrgsz, "+");
  181. lstrcat (lrgsz, Ieung_I);
  182. vbuf [wcount++] = POS_OTHERS | COPULA_OTHERS;
  183. return NUM_VALID;
  184. }
  185. return MORECHECK;
  186. }
  187. // ----------------------------------------------------------------------
  188. //
  189. //
  190. // ----------------------------------------------------------------------
  191. int BaseEngine::NLP_Dap_Proc(char *stem)
  192. {
  193. char tmpstem[80],
  194. index[1],
  195. tmp [80];
  196. int ulspos, temp;
  197. lstrcpy(tmpstem, stem);
  198. ulspos = lstrlen(tmpstem)-1;
  199. _itoa (lstrlen (stem), tmp, 10);
  200. if(Dap.FindWord(tmpstem, ulspos) != -1)
  201. {
  202. _itoa (lstrlen (tmpstem), tmp, 10);
  203. index[0] = 'm';
  204. char tstem [80];
  205. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  206. if (FindSilsaWord (tstem) & _NOUN)
  207. {
  208. lstrcat (lrgsz, tstem);
  209. vbuf [wcount++] = POS_NOUN;
  210. lstrcat (lrgsz, "+");
  211. lstrcat (lrgsz, Tikeut_A_P);
  212. vbuf [wcount++] = POS_SUFFIX;
  213. return Dap_VALID;
  214. }
  215. if(FindIrrWord(tmpstem, _ZPN) & FINAL)
  216. {
  217. char tstem [80];
  218. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  219. lstrcat (lrgsz, tstem);
  220. vbuf [wcount++] = POS_PRONOUN;
  221. lstrcat (lrgsz, "+");
  222. lstrcat (lrgsz, Tikeut_A_P);
  223. vbuf [wcount++] = POS_SUFFIX;
  224. return Dap_VALID;
  225. }
  226. if(__IsDefStem(ulspos, 2) == 1 &&
  227. tmpstem[ulspos-2] == __K_D && tmpstem[ulspos-1] == __V_m && tmpstem[ulspos] == __K_R)
  228. {
  229. temp = ulspos;
  230. __DelStemN(tmpstem, &temp, 3);
  231. ulspos = temp;
  232. index[0] = 'm';
  233. char tstem [80];
  234. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  235. if (FindSilsaWord (tstem) & _NOUN)
  236. {
  237. lstrcat (lrgsz, tstem);
  238. vbuf [wcount++] = POS_NOUN;
  239. lstrcat (lrgsz, "+");
  240. lstrcat (lrgsz, Tikeut_A_P);
  241. vbuf [wcount++] = POS_SUFFIX;
  242. return Dap_VALID;
  243. }
  244. }
  245. }
  246. return MORECHECK;
  247. }
  248. // ----------------------------------------------------------------------
  249. //
  250. //
  251. // ----------------------------------------------------------------------
  252. int BaseEngine::NLP_Gop_Proc(char *stem)
  253. {
  254. char tmpstem[80];
  255. int temp, ulspos;
  256. lstrcpy(tmpstem, stem);
  257. ulspos = lstrlen(tmpstem)-1;
  258. if(__IsDefStem(ulspos, 3) == 1 &&
  259. tmpstem[ulspos-3] == __K_G && tmpstem[ulspos-2] == __V_h &&
  260. tmpstem[ulspos-1] == __K_P && tmpstem[ulspos] == __V_m)
  261. {
  262. temp = ulspos;
  263. __DelStemN(tmpstem, &temp, 4);
  264. ulspos = temp;
  265. char tstem [80];
  266. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  267. if (FindSilsaWord (tstem) & _VERB)
  268. {
  269. lstrcat (lrgsz, tstem);
  270. vbuf [wcount++] = POS_VERB;
  271. lstrcat (lrgsz, "+");
  272. lstrcat (lrgsz, KO_PHEU);
  273. vbuf [wcount++] = POS_SUFFIX;
  274. return Gop_VALID;
  275. }
  276. }
  277. return MORECHECK;
  278. }
  279. // ----------------------------------------------------------------------
  280. //
  281. //
  282. // ----------------------------------------------------------------------
  283. int BaseEngine::NLP_Manha_Proc(char *stem)
  284. {
  285. char index[1], tmpstem[80];
  286. int temp, ulspos;
  287. lstrcpy(tmpstem, stem);
  288. ulspos = lstrlen(tmpstem)-1;
  289. if(__IsDefStem(ulspos, 4) == 1 &&
  290. tmpstem[ulspos-4] == __K_M && tmpstem[ulspos-3] == __V_k && tmpstem[ulspos-2] == __K_N &&
  291. tmpstem[ulspos-1] == __K_H && tmpstem[ulspos] == __V_k)
  292. {
  293. temp = ulspos;
  294. __DelStemN(tmpstem, &temp, 5);
  295. ulspos = temp;
  296. index[0] = 'm';
  297. char tstem [80];
  298. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  299. if (FindSilsaWord (tstem) & _NOUN)
  300. {
  301. lstrcat (lrgsz, tstem);
  302. vbuf [wcount++] = POS_NOUN;
  303. lstrcat (lrgsz, "+");
  304. lstrcat (lrgsz, MAN_HA);
  305. vbuf [wcount++] = POS_SUFFIX;
  306. return Manha_VALID;
  307. }
  308. if(FindIrrWord(tmpstem, _ZPN) & FINAL)
  309. {
  310. char tstem [80];
  311. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  312. lstrcat (lrgsz, tstem);
  313. vbuf [wcount++] = POS_PRONOUN;
  314. lstrcat (lrgsz, "+");
  315. lstrcat (lrgsz, MAN_HA);
  316. vbuf [wcount++] = POS_SUFFIX;
  317. return Manha_VALID;
  318. }
  319. }
  320. if(__IsDefStem(ulspos, 4) == 1 &&
  321. tmpstem[ulspos-4] == __K_I && tmpstem[ulspos-3] == __V_u && tmpstem[ulspos-2] == __K_N &&
  322. tmpstem[ulspos-1] == __K_H && tmpstem[ulspos] == __V_k)
  323. {
  324. temp = ulspos;
  325. __DelStemN(tmpstem, &temp, 5);
  326. ulspos = temp;
  327. index[0] = 'm';
  328. char tstem [80];
  329. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  330. if (FindSilsaWord (tstem) & _NOUN)
  331. {
  332. lstrcat (lrgsz, tstem);
  333. vbuf [wcount++] = POS_NOUN;
  334. lstrcat (lrgsz, "+");
  335. lstrcat (lrgsz, IYEON_HA);
  336. vbuf [wcount++] = POS_SUFFIX;
  337. return Yenha_VALID;
  338. }
  339. if(FindIrrWord(tmpstem, _ZPN) & FINAL)
  340. {
  341. char tstem [80];
  342. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  343. lstrcat (lrgsz, tstem);
  344. vbuf [wcount++] = POS_PRONOUN;
  345. lstrcat (lrgsz, "+");
  346. lstrcat (lrgsz, IYEON_HA);
  347. vbuf [wcount++] = POS_SUFFIX;
  348. return Yenha_VALID;
  349. }
  350. }
  351. return MORECHECK;
  352. }
  353. // ----------------------------------------------------------------------
  354. //
  355. //
  356. // ----------------------------------------------------------------------
  357. int BaseEngine::NLP_Manhaeci_Proc(char *stem)
  358. {
  359. char index[1], tmpstem[80];
  360. int temp, ulspos;
  361. lstrcpy(tmpstem, stem);
  362. ulspos = lstrlen(tmpstem)-1;
  363. if(__IsDefStem(ulspos, 6) == 1 &&
  364. tmpstem[ulspos-6] == __K_M && tmpstem[ulspos-5] == __V_k && tmpstem[ulspos-4] == __K_N &&
  365. tmpstem[ulspos-3] == __K_H && tmpstem[ulspos-2] == __V_o &&
  366. tmpstem[ulspos-1] == __K_J && tmpstem[ulspos] == __V_l)
  367. {
  368. temp = ulspos;
  369. __DelStemN(tmpstem, &temp, 7);
  370. ulspos = temp;
  371. index[0] = 'm';
  372. char tstem [80];
  373. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  374. if (FindSilsaWord (tstem) & _NOUN)
  375. {
  376. lstrcat (lrgsz, tstem);
  377. vbuf [wcount++] = POS_NOUN;
  378. lstrcat (lrgsz, "+");
  379. lstrcat (lrgsz, MAN_HAE_CI);
  380. vbuf [wcount++] = POS_SUFFIX;
  381. return Manhaeci_VALID;
  382. }
  383. if(FindIrrWord(tmpstem, _ZPN) & FINAL)
  384. {
  385. char tstem [80];
  386. Conv.INS2HAN (tmpstem, tstem, codeWanSeong);
  387. lstrcat (lrgsz, tstem);
  388. vbuf [wcount++] = POS_PRONOUN;
  389. lstrcat (lrgsz, "+");
  390. lstrcat (lrgsz, MAN_HAE_CI);
  391. vbuf [wcount++] = POS_SUFFIX;
  392. return Manhaeci_VALID;
  393. }
  394. }
  395. return MORECHECK;
  396. }
  397. // ----------------------------------------------------------------------
  398. //
  399. //
  400. // ----------------------------------------------------------------------
  401. int BaseEngine::NLP_VCV_Proc(char *stem,
  402. char *ending)
  403. {
  404. char r_vowel = NULLCHAR,
  405. tmpend[80],
  406. tmpstem[80];
  407. int lenuls, ulspos, lmepos;
  408. lstrcpy(tmpstem, stem);
  409. lstrcpy(tmpend, ending);
  410. ulspos = lstrlen(tmpstem) - 1;
  411. lmepos = lstrlen(tmpend) - 1;
  412. lenuls = lstrlen(tmpstem) - 1;
  413. if(__IsDefEnd(lmepos, 1) == 1 &&
  414. tmpend[lmepos] == __K_I && tmpend[lmepos-1] == __V_j)
  415. {
  416. for (int i = lenuls; i >= 0; i--)
  417. if(tmpstem[i] >= __V_k)
  418. {
  419. r_vowel = tmpstem[i];
  420. break;
  421. }
  422. if(r_vowel == __V_h || r_vowel == __V_k || r_vowel == __V_i)
  423. return INVALID;
  424. if(tmpstem[lenuls] == __V_j) return MORECHECK;
  425. return VCV_VALID;
  426. }
  427. if(__IsDefEnd(lmepos, 1) == 1 &&
  428. tmpend[lmepos] == __K_I && tmpend[lmepos-1] == __V_k)
  429. {
  430. for (int i = lenuls; i >= 0; i--)
  431. if(tmpstem[i] >= __V_k)
  432. {
  433. r_vowel = tmpstem[i];
  434. break;
  435. }
  436. if(r_vowel == __V_h || r_vowel == __V_k || r_vowel == __V_i)
  437. {
  438. if(tmpstem[lenuls] == __V_k) return MORECHECK;
  439. else return VCV_VALID;
  440. }
  441. return INVALID;
  442. }
  443. return VCV_VALID;
  444. }
  445. // ----------------------------------------------------------------------
  446. //
  447. //
  448. // ----------------------------------------------------------------------
  449. int BaseEngine::NLP_Blocking(char *stem,
  450. char *ending)
  451. {
  452. char tmpstem[80],
  453. tmpend[80];
  454. int lmepos,
  455. lULSPOS;
  456. lstrcpy(tmpstem, stem);
  457. lstrcpy(tmpend, ending);
  458. lULSPOS = lstrlen(tmpstem) - 1;
  459. lmepos = LMEPOS;
  460. switch (LME)
  461. {
  462. case __K_N :
  463. if(strcmp(tmpend, TempRa[1]) == 0)
  464. {
  465. if(FindIrrWord(stem, _IV_Nj) & FINAL)
  466. {
  467. return Bloc_VALID;
  468. }
  469. return INVALID;
  470. }
  471. if(tmpstem[lULSPOS] == __K_R)
  472. {
  473. return INVALID;
  474. }
  475. if(FindIrrWord(tmpstem, _IA_HP) & FINAL ||
  476. FindIrrWord(tmpstem, _IA_HM) & FINAL)
  477. {
  478. return INVALID;
  479. }
  480. if(__IsDefStem(lULSPOS, 2) == 1 && tmpstem[lULSPOS] == __K_S_D &&
  481. tmpstem[lULSPOS-1] == __V_l && tmpstem[lULSPOS-2] == __K_I)
  482. {
  483. if(__IsDefEnd(lmepos, 4) == 1 &&
  484. ending[lmepos] == __K_N && ending[lmepos-1] == __V_m &&
  485. ending[lmepos-2] == __K_N && ending[lmepos-3] == __K_G &&
  486. ending[lmepos-4] == __V_n)
  487. {
  488. return INVALID;
  489. }
  490. }
  491. return Bloc_VALID;
  492. case __K_S :
  493. if(tmpstem[lULSPOS] == __K_R)
  494. {
  495. return INVALID;
  496. }
  497. return Bloc_VALID;
  498. case __K_I :
  499. if(__IsDefEnd(lmepos, 1) == 1 &&
  500. (tmpend[lmepos-1] == __V_h || tmpend[lmepos-1] == __V_l ||
  501. tmpend[lmepos-1] == __V_hl))
  502. {
  503. if(tmpstem[lULSPOS] == __K_R)
  504. {
  505. return INVALID;
  506. }
  507. return Bloc_VALID;
  508. }
  509. if(__IsDefEnd(lmepos, 2) == 1 &&
  510. tmpend[lmepos-1] == __V_m && tmpend[lmepos-2] == __K_N)
  511. {
  512. if((__IsDefStem(lULSPOS, 3) == 1 &&
  513. strcmp(tmpstem+(lULSPOS-3), Tempiss[0]) == 0) ||
  514. (__IsDefStem(lULSPOS, 2) == 1 &&
  515. strcmp(tmpstem+(lULSPOS-2), Tempiss[1]) == 0))
  516. {
  517. if(__IsDefEnd(lmepos, 3) == 1 && tmpend[lmepos-3] == __V_k)
  518. {
  519. return Bloc_VALID;
  520. }
  521. if(__IsDefEnd(lmepos, 3) == 1 && tmpend[lmepos-3] == __V_l)
  522. {
  523. if(__IsDefEnd(lmepos, 5) == 1 &&
  524. tmpend[lmepos-4] == __K_R && tmpend[lmepos-5] == __V_k)
  525. {
  526. return INVALID;
  527. }
  528. return Bloc_VALID;
  529. }
  530. return INVALID;
  531. }
  532. }
  533. return Block_Comm;
  534. }
  535. if(strcmp(tmpend, TempRa[0]) == 0)
  536. {
  537. if(FindIrrWord(tmpstem, _IV_Gj) & FINAL)
  538. {
  539. return Bloc_VALID;
  540. }
  541. return INVALID;
  542. }
  543. return Bloc_VALID;
  544. }
  545. // ----------------------------------------------------------------------
  546. //
  547. //
  548. // ----------------------------------------------------------------------
  549. int BaseEngine::NLP_Block_Comm(char *stem,
  550. char *ending)
  551. {
  552. int StemPos,
  553. EndPos;
  554. char tmp[80],
  555. end[80];
  556. lstrcpy(tmp, stem);
  557. lstrcpy(end, ending);
  558. EndPos = lstrlen(end) - 1;
  559. StemPos = lstrlen(tmp) - 1;
  560. switch (tmp[StemPos])
  561. {
  562. case __V_k :
  563. if(__IsDefStem(StemPos, 1) == 1 && stem[StemPos-1] == __K_H)
  564. return INVALID;
  565. break;
  566. case __V_m :
  567. return INVALID;
  568. case __V_n :
  569. if(__IsDefStem(StemPos, 1) == 1 && stem[StemPos-1] == __K_I)
  570. return INVALID;
  571. if(strcmp(tmp, TempBC) == 0)
  572. return INVALID;
  573. break;
  574. case __K_H :
  575. if(FindIrrWord(tmp, _IA_HP) & FINAL ||
  576. FindIrrWord(tmp, _IA_HM) & FINAL)
  577. return INVALID;
  578. break;
  579. case __K_B :
  580. if(FindIrrWord(tmp, _RA_B) & FINAL)
  581. {
  582. return Bloc_VALID;
  583. }
  584. char tstem [80];
  585. Conv.INS2HAN (tmp, tstem, codeWanSeong);
  586. if (FindSilsaWord (tstem) & _ADJECTIVE)
  587. return INVALID;
  588. if(__IsDefStem(StemPos, 2) == 1 &&
  589. tmp[StemPos-2] == __K_D && tmp[StemPos-1]==__V_k)
  590. return INVALID;
  591. if(FindIrrWord(tmp, _IV_BM) & FINAL ||
  592. FindIrrWord(tmp, _IV_BP) & FINAL)
  593. return INVALID;
  594. break;
  595. case __K_S :
  596. if(FindIrrWord(tmp, _IV_SP) & FINAL ||
  597. FindIrrWord(tmp, _IV_SM) & FINAL)
  598. return INVALID;
  599. break;
  600. case __K_D :
  601. if(FindIrrWord(tmp, _IV_DP) & FINAL)
  602. {
  603. if(FindIrrWord(tmp, _RV_D) & FINAL) // V2R
  604. {
  605. return Bloc_VALID;
  606. }
  607. return INVALID;
  608. }
  609. if(FindIrrWord(tmp, _IV_DM) & FINAL)
  610. {
  611. if(FindIrrWord(tmp, _RV_D) & FINAL) // V2R
  612. {
  613. return Bloc_VALID;
  614. }
  615. return INVALID;
  616. }
  617. break;
  618. }
  619. return Bloc_VALID;
  620. }
  621. // ----------------------------------------------------------------------
  622. //
  623. //
  624. // ----------------------------------------------------------------------
  625. int BaseEngine::NLP_VCV_Check(char *stem,
  626. char *ending)
  627. {
  628. char tmp[80],
  629. end[80];
  630. int ret, luls, llme;
  631. lstrcpy(tmp, stem);
  632. lstrcpy(end, ending);
  633. llme = LMEPOS;
  634. luls = ULSPOS;
  635. if(ACT_C == 1 && ACT_V == 1)
  636. {
  637. if((ret = NLP_VCV_Proc(stem, ending)) == VCV_VALID)
  638. if((ret = NLP_Blocking(stem, ending)) == Block_Comm)
  639. ret = NLP_Block_Comm(stem, ending);
  640. return ret;
  641. }
  642. if(ACT_C == 1 && ACT_V == 0)
  643. {
  644. if(ULS >= __V_k || ULS == __K_R)
  645. return MORECHECK;
  646. else
  647. {
  648. if((ret = NLP_VCV_Proc(stem, ending)) == VCV_VALID)
  649. if((ret = NLP_Blocking(stem, ending)) == Block_Comm)
  650. ret = NLP_Block_Comm(stem, ending);
  651. return ret;
  652. }
  653. }
  654. if(__IsDefEnd(llme , 3) == 1 &&
  655. end[llme] == __K_G && end[llme-1] == __V_j &&
  656. end[llme-2] == __K_R && end[llme-3] == __V_k)
  657. {
  658. if((ret = NLP_Blocking(stem, ending)) == Block_Comm)
  659. ret = NLP_Block_Comm(stem, ending);
  660. return ret;
  661. }
  662. if(__IsDefEnd(llme , 3) == 1 &&
  663. end[llme] == __K_N && end[llme-1] == __V_j &&
  664. end[llme-2] == __K_R && end[llme-3] == __V_k)
  665. {
  666. if((ret = NLP_Blocking(stem, ending)) == Block_Comm)
  667. ret = NLP_Block_Comm(stem, ending);
  668. return ret;
  669. }
  670. if(ULS >= __V_k || ULS == __K_R)
  671. {
  672. if((ret = NLP_VCV_Proc(stem, ending)) == VCV_VALID)
  673. if((ret = NLP_Blocking(stem, ending)) == Block_Comm)
  674. ret = NLP_Block_Comm(stem, ending);
  675. return ret;
  676. }
  677. return MORECHECK;
  678. }
  679. // ----------------------------------------------------------------------
  680. //
  681. //
  682. // ----------------------------------------------------------------------
  683. int BaseEngine::NLP_AUX_VCV_Check(char *stem,
  684. char *ending)
  685. {
  686. char tmp[80],
  687. end[80];
  688. int ret, luls, llme;
  689. lstrcpy(tmp, stem);
  690. lstrcpy(end, ending);
  691. llme = AUX_LMEPOS;
  692. luls = AUX_ULSPOS;
  693. if(AUX_ACT_C == 1 && AUX_ACT_V == 1)
  694. {
  695. if((ret = NLP_VCV_Proc(stem, ending)) == VCV_VALID)
  696. {
  697. if((ret = NLP_AUX_Blocking(stem, ending)) == Block_Comm)
  698. {
  699. ret = NLP_Block_Comm(stem, ending);
  700. }
  701. }
  702. return ret;
  703. }
  704. if(AUX_ACT_C == 1 && AUX_ACT_V == 0)
  705. {
  706. if(stem[luls] >= __V_k || stem[luls] == __K_R)
  707. {
  708. return MORECHECK;
  709. }
  710. else
  711. {
  712. if((ret = NLP_VCV_Proc(stem, ending)) == VCV_VALID)
  713. {
  714. if((ret = NLP_AUX_Blocking(stem, ending)) == Block_Comm)
  715. {
  716. ret = NLP_Block_Comm(stem, ending);
  717. }
  718. }
  719. return ret;
  720. }
  721. }
  722. if(stem[luls] >= __V_k || stem[luls] == __K_R)
  723. {
  724. if((ret = NLP_VCV_Proc(stem, ending)) == VCV_VALID)
  725. {
  726. if((ret = NLP_AUX_Blocking(stem, ending)) == Block_Comm)
  727. {
  728. ret = NLP_Block_Comm(stem, ending);
  729. }
  730. }
  731. return ret;
  732. }
  733. return MORECHECK;
  734. }
  735. // -------------------------------------------------------------------------------------
  736. //
  737. //
  738. // -------------------------------------------------------------------------------------
  739. int BaseEngine::NLP_AUX_Blocking(char *aux_stem,
  740. char *aux_ending)
  741. {
  742. char tmp[80],
  743. end[80];
  744. int lEND,
  745. lAUXULS;
  746. lstrcpy (tmp, aux_stem);
  747. lstrcpy (end, aux_ending);
  748. lAUXULS = AUX_ULSPOS;
  749. lEND = AUX_LMEPOS;
  750. switch (AUXLME)
  751. {
  752. case __K_N :
  753. if(tmp[lAUXULS] == __K_R)
  754. {
  755. return INVALID;
  756. }
  757. return Bloc_VALID;
  758. case __K_I :
  759. if(__IsDefEnd(lEND, 2) == 1 &&
  760. end[lEND-1] == __V_m && end[lEND-2] == __K_N)
  761. {
  762. // Temp -> Tempiss : by hjw 95/3/3
  763. if((__IsDefStem(lAUXULS, 3) == 1 &&
  764. strcmp(tmp+(lAUXULS-3), Tempiss[0]) == 0) ||
  765. (__IsDefStem(lAUXULS, 2) == 1 &&
  766. strcmp(tmp+(lAUXULS-2), Tempiss[1]) == 0) )
  767. {
  768. return INVALID;
  769. }
  770. }
  771. return Block_Comm;
  772. }
  773. return Bloc_VALID;
  774. }