{"id":28405243,"url":"https://github.com/coxcore/postposition","last_synced_at":"2025-08-07T04:43:24.332Z","repository":{"id":24091309,"uuid":"100606107","full_name":"coxcore/postposition","owner":"coxcore","description":"한글, 영문, 숫자에 대한 한글 조사(josa) 은/는, 이/가, 을/를 등을 처리하는 Javascript Library 입니다.","archived":false,"fork":false,"pushed_at":"2024-10-16T07:54:01.000Z","size":972,"stargazers_count":39,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T04:36:43.816Z","etag":null,"topics":["es6","javascript","josa","korean","library","postposition"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coxcore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-17T13:25:52.000Z","updated_at":"2025-06-27T00:47:11.000Z","dependencies_parsed_at":"2024-10-23T23:05:02.118Z","dependency_job_id":null,"html_url":"https://github.com/coxcore/postposition","commit_stats":{"total_commits":79,"total_committers":2,"mean_commits":39.5,"dds":"0.17721518987341767","last_synced_commit":"91f2f3de1261bab4ebf4d72fe3c23763cd61ecb7"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/coxcore/postposition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coxcore%2Fpostposition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coxcore%2Fpostposition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coxcore%2Fpostposition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coxcore%2Fpostposition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coxcore","download_url":"https://codeload.github.com/coxcore/postposition/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coxcore%2Fpostposition/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269201173,"owners_count":24377450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["es6","javascript","josa","korean","library","postposition"],"created_at":"2025-06-01T21:11:16.756Z","updated_at":"2025-08-07T04:43:24.313Z","avatar_url":"https://github.com/coxcore.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cox.postposition\n\u003e 한글, 영문, 숫자에 대한 한글 조사를 선택하거나 적용합니다. 단, 영문은 모든 상황에 대해 100% 지원하지 않습니다.\n\n## 예제\n\n[예제 보기](https://coxcore.github.io/postposition/1.4.0/demo/index.html)\n\n## 설치하기\n\n#### NPM\n\n```html\n$ npm install cox-postposition\n```\n\n`npm install`을 통해 설치하는 경우 `ES6` 문법으로 작성한 원본 JS 파일을 참조합니다.\n따라서 `ES6`를 지원하지 않는 환경에서는 [UMD](#umd---es6-module을-지원하지-않는-환경) 사용법을 참고하여 사용하시기 바랍니다\n\n#### CDN\n```html\n// jsdelivr\nhttps://cdn.jsdelivr.net/npm/cox-postposition@1.4.1/dist/cox.postposition.min.js\n```\n\n#### DOWNLOAD\n- [Github](https://github.com/coxcore/postposition/releases)\n\n\n## 사용법\n\n#### ES6\n```js\nimport postposition from 'cox-postposition';\n\nconst kor = postposition.put('고양이', '을');\nconst eng = postposition.put('cat', '을');\nconst num = postposition.put('8', '을');\nconst sentence1 = postposition.parse('바다[로|으로] 이동하면 잠수함[를|을] 얻습니다.');\nconst sentence2 = postposition.parse('바다[로*] 이동하면 잠수함[를*] 얻습니다.');\n\nconsole.log(kor); // 고양이를\nconsole.log(eng); // cat을 ('씨에이티를'이 아닌 '캣을'로 처리)\nconsole.log(num); // 8을\nconsole.log(sentence1); // 바다로 이동하면 잠수함을 얻습니다.\nconsole.log(sentence2); // 바다로 이동하면 잠수함을 얻습니다.\n```\n\n#### UMD - ES6 Module을 지원하지 않는 환경\n\n```js\nconst postposition = require('cox-postposition/umd');\n\nconst kor = postposition.put('고양이', '을');\nconst eng = postposition.put('cat', '을');\nconst num = postposition.put('8', '을');\nconst sentence1 = postposition.parse('바다[로|으로] 이동하면 잠수함[를|을] 얻습니다.');\nconst sentence2 = postposition.parse('바다[로*] 이동하면 잠수함[를*] 얻습니다.');\n\nconsole.log(kor); // 고양이를\nconsole.log(eng); // cat을 ('씨에이티를'이 아닌 '캣을'로 처리)\nconsole.log(num); // 8을\nconsole.log(sentence1); // 바다로 이동하면 잠수함을 얻습니다.\nconsole.log(sentence2); // 바다로 이동하면 잠수함을 얻습니다.\n```\n\n#### HTML\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/cox-postposition@1.4.1/dist/cox.postposition.min.js\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  var kor = cox.postposition.put('고양이', '을');\n  var eng = cox.postposition.put('cat', '을');\n  var num = cox.postposition.put('8', '을');\n  var sentence1 = cox.postposition.parse('바다[로|으로] 이동하면 잠수함[를|을] 얻습니다.');\n  var sentence2 = cox.postposition.parse('바다[로*] 이동하면 잠수함[를*] 얻습니다.');\n\n  console.log(kor); // 고양이를\n  console.log(eng); // cat을 ('씨에이티를'이 아닌 '캣을'로 처리)\n  console.log(num); // 8을\n  console.log(sentence1); // 바다로 이동하면 잠수함을 얻습니다.\n  console.log(sentence2); // 바다로 이동하면 잠수함을 얻습니다.\n\u003c/script\u003e\n```\n\n\n#### Details\n\n```js\nimport postposition from 'cox-postposition';\n\n// 종성이 있는지 여부 (종성이 있으면 true)\npostposition.check('바다'); // false\npostposition.check('하늘'); // true\n\n// 로/으로에 대한 종성이 있는지 여부 ('ㄹ'은 종성이 없는 것으로 간주)\npostposition.check('바다', '로'); // false\npostposition.check('하늘', '로'); // false\npostposition.check('구름', '로'); // true\n\n// 입력한 단어에 따른 조사 반환 (이/가를 처리하려면 '이'나 '가'를 입력)\npostposition.pick('고양이', '이'); // 가\npostposition.pick('고양이', '가'); // 가\npostposition.pick('\u003c고양이\u003e', '가'); // 가\n\n// 입력한 단어에 조사 적용 (한글, 영어, 숫자에 대응)\npostposition.put('cat', '을'); // cat을\npostposition.put('cat', '를'); // cat을\npostposition.put('[cat]', '를'); // [cat]을\n\n// 은/는, 이/가, 을/를, 과/와, 나/이나, 로/으로 이외의 조사 처리 (종성이 없는 조건을 먼저 입력)\npostposition.put('고양이', '야', '아'); // 고양이야\npostposition.put('야옹', '야', '아'); // 야옹아\n\n// 입력한 문장에서 기본 지원 조사 적용\npostposition.parse('예제1[와*] 예제2[을*] 확인하세요.'); // 예제1과 예제2를 확인하세요.\npostposition.parse('예제[1][과*] 예제[2][를*] 확인하세요.'); // 예제[1]과 예제[2]를 확인하세요.\n\n// 입력한 문장에서 사용자 정의 조사 적용\npostposition.parse('예제1[와|과] 예제2[를|을] 확인하세요.'); // 예제1과 예제2를 확인하세요.\npostposition.parse('예제[1][와|과] 예제[2][를|을] 확인하세요.'); // 예제[1]과 예제[2]를 확인하세요.\npostposition.parse('음식[|이]면 A, food[|이]면 B'); // 음식이면 A, food면 B\n\n// 지정한 조사만 처리하는 함수 생성\nconst putEul = postposition.fix('을');\nconst putRang = postposition.fix('랑', '이랑');\n\nputEul('바위'); // 바위를\nputEul('rock'); // rock을\nputRang('바위'); // 바위랑\nputRang('rock'); // rock이랑\n```\n\n개별 메서드만 사용할 수도 있습니다.\n\n```js\nimport { check, pick, put, parse, fix } from 'cox-postposition';\n\n// 종성이 있는지 여부\ncheck('바다'); // false\n\n// 입력한 단어에 따른 조사 반환\npick('고양이', '이'); // 가\n\n// 입력한 단어에 조사 적용\nput('cat', '을'); // cat을\n\n// 입력한 문장에 조사 적용\nparse('하늘[와*] 땅'); // 하늘과 땅\nparse('하늘[와|과] 땅'); // 하늘과 땅\n\n\n// 지정한 조사만 처리 함수 생성\nconst putEul = fix('을');\n\nputEul('바위'); // 바위를\n```\n\n## Method\n\n### check( text[, type] )\n\n\u003e 종성이 있는지 여부를 체크합니다.\n\n* `text`: [필수] 종성이 있는지를 체크할 단어\n* `type`: [선택] 조사 타입('로/으로'인 경우 사용)\n* `return`: 종성이 있는지 여부\n\n조사가 `로/으로`가 아닌 경우는 `type` 파라미터를 생략해도 됩니다.\n\n```js\n// 종성이 없는 단어\npostposition.check('바다'); // false\npostposition.check('sea'); // false\npostposition.check('2'); // false\n\n// 종성이 있는 단어\npostposition.check('필름'); // true\npostposition.check('film'); // true\npostposition.check('6'); // true\n```\n\n조사가 `로/으로`인 경우는 종성이 `ㄹ`이면 종성이 없는 것으로 간주합니다. 단 `로/으로` 조사 타입에 대한 결과를 반환하는 것이지 `로`나 `으로`에 대해서 파라미터와 비교한 결과를 반환하는 것이 아닙니다.\n\n```js\n// 종성이 'ㄹ'인 경우\npostposition.check('가을', '로'); // false\npostposition.check('feel', '로'); // false\npostposition.check('7', '로'); // false\n```\n\n### pick( text, type[, special] )\n\n\u003e 단어에 맞는 조사를 반환합니다.\n\n* `text`: [필수] 종성을 적용할 단어\n* `type`: [필수] 조사 타입, 종성이 없을 때 조사\n* `special`: [선택] 종성이 있을 때 조사\n* `return`: 적용할 조사\n\n다음 조사에 대해서는 `special` 파라미터를 생략하고, 종성 유무와 관계 없이 둘 중 하나만 입력하면 됩니다.\n\n* 는/은\n* 가/이\n* 와/과\n* 를/을\n* 나/이나\n* 로/으로\n\n```js\n// 종성이 없는 단어\npostposition.pick('바다', '가'); // 가\npostposition.pick('sea', '이'); // 가\npostposition.pick('2', '가'); // 가\n\n// 종성이 있는 단어\npostposition.pick('필름', '가'); // 이\npostposition.pick('film', '이'); // 이\npostposition.pick('6', '가'); // 이\n\n// 조사가 '로/으로'이고 종성이 'ㄹ'인 경우\npostposition.pick('가을', '으로'); // 로\npostposition.pick('feel', '로'); // 로\npostposition.pick('8', '으로'); // 로\n```\n\n기본 조사에서 지원하지 않는 경우는 직접 지정할 수 있습니다. 종성이 없는 조건, 종성이 있는 조건 순으로 파라미터를 전달합니다.\n\n```js\npostposition.pick('바다', '야', '아'); // 야\npostposition.pick('swimming', '랑', '이랑'); // 이랑\npostposition.pick('1', '면', '이면'); // 이면\n```\n\n### put( text, type[, special] )\n\n\u003e 단어에 맞는 조사를 적용한 글자를 반환합니다.\n\n* `text`: [필수] 종성을 적용할 단어\n* `type`: [필수] 조사 타입, 종성이 없을 때 조사\n* `special`: [선택] 종성이 있을 때 조사\n* `return`: 단어에 조사를 적용한 글자\n\n`pick` 메서드와 동일한 처리를 하지만 대상 글자에 조사를 적용한 글자가 반환됩니다.\n\n```js\n// 종성이 없는 단어\npostposition.put('바다', '가'); // 바다가\npostposition.put('sea', '이'); // sea가\npostposition.put('2', '가'); // 2가\npostposition.put('[9]', '이'); // [9]가\n\n// 종성이 있는 단어\npostposition.put('필름', '가'); // 필름이\npostposition.put('film', '이'); // film이\npostposition.put('6', '가'); // 6이\npostposition.put('\"7\"', '이'); // \"7\"이\n\n// 조사가 '로/으로'이고 종성이 'ㄹ'인 경우\npostposition.put('가을', '으로'); // 가을로\npostposition.put('feel', '로'); // feel로\npostposition.put('7', '으로'); // 7로\npostposition.put('(8)', '로'); // (8)로\n```\n\n`pick` 메서드와 동일하게 종성 여부에 따른 조사를 직접 지정할 수 있습니다.\n\n```js\npostposition.put('바다', '야', '아'); // 바다야\npostposition.put('swimming', '랑', '이랑'); // swimming이랑\npostposition.put('7', '면', '이면'); // 7이면\npostposition.put('드림(dream)', '라서', '이라서'); // 드림(dream)이라서\n```\n\n\n### fix( type[, special] )\n\n\u003e 특정 조사를 처리하는 함수를 반환합니다.\n\n* `type`: 조사 타입, 종성이 없을 때 조사\n* `special`: [선택] 종성이 있을 때 조사\n* `return`: 지정한 조사를 처리하는 함수 반환\n\n특정 조사를 반복해서 처리하는 경우는 원하는 조사를 지정하여 함수를 생성할 수 있습니다.\n\n```js\n// 은/는을 처리하는 함수\nconst eun = postposition.fix('는');\n\n// 을/를을 처리하는 함수\nconst eul = postposition.fix('를');\n\n// 아/야를 처리하는 함수\nconst ya = postposition.fix('야', '아');\n\n\neun('구름'); // 구름은\neul('구름'); // 구름을\nya('구름'); // 구름아\n\n```\n\n\n### parse( sentence )\n\n\u003e 문장에서 `단어[조사*]` 혹은 `단어[종성이 없을 때 조사|종성이 있을 때 조사]` 패턴을 찾아서 해당 단어의 조사를 처리합니다.\n\n* `sentence`: 처리할 문장\n\n문장에서 특정 단어에 대한 조사를 처리할 때 사용할 수 있습니다.\n\n```js\nconst result1 = postposition.parse('망치[를|을] 만드려면 손잡이[가|이] 필요합니다.');\nconst result2 = postposition.parse('그림[P][와|과] 그림[L][는|은] animal[를|을] 포함합니다.');\n\nconsole.log(result1); // 망치를 만드려면 손잡이가 필요합니다.\nconsole.log(result2); // 그림[P]와 그림[L]은 animal을 포함합니다.\n```\n\n`단어[조사*]` 패턴을 이용하면 문장에서 기본 지원 조사를 처리할 때 사용할 수 있습니다.\n\n```js\nconst result1 = postposition.parse('망치[을*] 만드려면 손잡이[이*] 필요합니다.');\nconst result2 = postposition.parse('그림[P][과*] 그림[L][는*] animal[를*] 포함합니다.');\n\nconsole.log(result1); // 망치를 만드려면 손잡이가 필요합니다.\nconsole.log(result2); // 그림[P]와 그림[L]은 animal을 포함합니다.\n```\n\n## Guide\n\n한글은 종성에 따라 조사가 결정되므로 종성 유무를 파악하여 조사를 구분하도록 처리하고 있습니다. 단, `로/으로`에 한해서 `ㄹ` 종성은 없는 것으로 예외처리합니다.\n\n영문의 경우는 영어 발음을 기준으로 처리합니다. 단, 영문의 경우는 발음을 표기하는 방식에 규칙이 없기 때문에 흔한 상황 위주로 분류하고 특수한 사례를 개별 관리하고 있습니다.\n\n```html\n// me로 끝나는 단어\nme -\u003e me[미]는\nsome - some[썸]은\n\n// oot로 끝나는 단어\nroot -\u003e root[루트]를\nfoot -\u003e foot[풋]을\n```\n\n한글의 영문 표기법에 따른 발음은 고려하지 않습니다.\n\n```html\n[Ji-sung Park] park -\u003e park[파크]를, 팍(X)\n[So Ji-sub] sub -\u003e sub[서브]를, 섭(X)\n```\n\n숫자의 경우는 한글 발음을 기준으로 합니다.\n\n```html\n동물1 -\u003e 동물1[일]을\nanimal3 -\u003e animal3[삼]을, 쓰리(X)\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoxcore%2Fpostposition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoxcore%2Fpostposition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoxcore%2Fpostposition/lists"}