├── .gitignore ├── LICENSE ├── README.md ├── index.js ├── package.json └── test.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Fatih Kadir Akın 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🧠 dahi.js 2 | 3 | Dahi `de`/`-de` farkını ayıran NLP projesidir. 4 | 5 | **⚠️ Bu proje şaka amaçlıdır, kullanmayın** ⚠️ 6 | 7 | ## Yükleme 8 | 9 | ```shell script 10 | npm install dahijs 11 | # ya da 12 | yarn add dahijs 13 | ``` 14 | 15 | ## Kullanım 16 | 17 | ```js 18 | const dahi = require('dahijs') 19 | 20 | dahi.fix('Bende sizinle geleceğim') # => 'Ben de sizinle geleceğim' 21 | ``` 22 | 23 | ## Katkı ve Test 24 | 25 | Projeye katkı yaparken lütfen tüm testlerden geçtiğini test edin. 26 | 27 | Testi çalıştırmak için: 28 | 29 | ```shell script 30 | npm test 31 | ``` 32 | 33 | komutunu çalşıtırın. Aşağıdaki şekilde çıktı alacaksınız. 34 | 35 | ```shell script 36 | "Bende geleceğim" değerinin "Ben de geleceğim" olması bekleniyor. 37 | "Bende seni seviyorum" değerinin "Ben de seni seviyorum" olması bekleniyor. 38 | "Sanada iyi geceler" değerinin "Sana da iyi geceler" olması bekleniyor. 39 | "Gelipte gitti" değerinin "Gelip de gitti" olması bekleniyor. 40 | "Raphael Benitez" değerinin "Raphael Benitez" olması bekleniyor. 41 | "Memnuniyetin bizide çok mutlu etti." değerinin "Memnuniyetin bizi de çok mutlu etti." olması bekleniyor. 42 | "Seninde yüreğin yansın" değerinin "Senin de yüreğin yansın" olması bekleniyor. 43 | "Böyle yapıpta nereye varmak istiyorsun" değerinin "Böyle yapıp da nereye varmak istiyorsun" olması bekleniyor. 44 | ``` 45 | 46 | ## Yanlış Pozitivite Oranı 47 | 48 | Program mevcut testler **%20** oranında yanlış pozitivite çıktı üretir. Aşağıdaki örnekler buna dahildir. 49 | 50 | ```shell script 51 | "Bende toplandık" değerinin "Ben de toplandık" olması bekleniyor. 52 | "Benim evde toplandık" değerinin "Benim ev de toplandık" olması bekleniyor. 53 | ``` 54 | 55 | # Lisans 56 | MIT 57 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | fix: function (str) { 3 | return str.replace(/([^'])([td])([ae])([\s\n,.])/gm, '$1 d$3$4') 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dahijs", 3 | "version": "0.0.1", 4 | "description": "de/-de farkını saptayan NLP projesi", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node test.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/f/dahi.git" 12 | }, 13 | "keywords": [ 14 | "nlp", 15 | "turkish" 16 | ], 17 | "author": "Fatih Kadir Akın ", 18 | "license": "MIT", 19 | "bugs": { 20 | "url": "https://github.com/f/dahi/issues" 21 | }, 22 | "homepage": "https://github.com/f/dahi#readme" 23 | } 24 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | const dahi = require('./') 2 | const assert = require('assert') 3 | 4 | let totalTest = 0 5 | let totalFalsePos = 0 6 | 7 | function test(actual, expected, falsePos = false) { 8 | try { 9 | console.log(`"${actual}" değerinin "${expected}" olması bekleniyor.`) 10 | const fixed = dahi.fix(actual) 11 | assert(expected === fixed, `Beklenen: ${expected}, Asıl: ${fixed}`) 12 | totalTest += 1 13 | totalFalsePos = (falsePos ? totalFalsePos + 1 : totalFalsePos) 14 | } catch (e) { 15 | console.error(e.message) 16 | } 17 | } 18 | 19 | test('Bende geleceğim', 'Ben de geleceğim') 20 | test('Bende seni seviyorum', 'Ben de seni seviyorum') 21 | test('Sanada iyi geceler', 'Sana da iyi geceler') 22 | test('Gelipte gitti', 'Gelip de gitti') 23 | test('Raphael Benitez', 'Raphael Benitez') 24 | test('Bende toplandık', 'Ben de toplandık', true) // false pos 25 | test('Benim evde toplandık', 'Benim ev de toplandık', true) // false pos 26 | test('Memnuniyetin bizide çok mutlu etti.', 'Memnuniyetin bizi de çok mutlu etti.') 27 | test('Seninde yüreğin yansın', 'Senin de yüreğin yansın') 28 | test('Böyle yapıpta nereye varmak istiyorsun', 'Böyle yapıp da nereye varmak istiyorsun') 29 | 30 | console.log(`\nToplam ${totalTest} çalıştı, yanlış pozitivite oranı ${100 * totalFalsePos / 10}%`) --------------------------------------------------------------------------------