Skip to content

Instantly share code, notes, and snippets.

View yunusemre002's full-sized avatar

Yunus Emre Demir yunusemre002

  • Yidiz Technical University
  • İstanbul
View GitHub Profile
@yunusemre002
yunusemre002 / replace_punctuation_with_space.js
Created November 12, 2021 14:53
replace_punctuation_with_space.js
const punctuation = /[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\s]/g;
preprocessingWord = (word) =>
word
.toLowerCase() // Convert all uppercase to lowercase
.replace(punctuation, ' ') // replace punctuation with space.
.replace(/ +/g, ' '); // Drop excess spaces.
@yunusemre002
yunusemre002 / js-turkish-to-english.js
Last active March 6, 2022 21:33
js-turkish-to-english.js
// It converts all lowercase or uppercase Turkish characters to English one on given text.
String.prototype.turkishToEnglish = function () {
return this
.replace(/Ğ/g, "G")
.replace(/ğ/g, "g")
.replace(/Ü/g, "U")
.replace(/ü/g, "u")
.replace(/Ş/g, "S")
.replace(/ş/g, "s")