Skip to content

Instantly share code, notes, and snippets.

@takvol
takvol / Copy.gs
Last active April 12, 2024 06:50
Copy google spreadsheet with all protected ranges permissions
function Main() {
var template = DriveApp.getFileById('YOUR_SPREADSHEET_ID'); //template spreadsheet
var destination = DriveApp.getFolderById('COPY_DESTINATION_FOLDER_ID'); //the directory to copy the file into
var curDate = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "yyyy-MM-dd");
var copyName = template.getName() + ' copy ' + curDate; //the filename that should be applied to the new copy (e.g. "My spreadsheet copy 2019-08-24")
copyTemplate(template, copyName, destination);
}
/**
@lisanka93
lisanka93 / ngrams.py
Created July 13, 2020 15:53
NLTK ngrams, bigrams and trigrams
from nltk.util import ngrams, word_tokenize, bigrams, trigrams
sen = "Dummy sentence to demonstrate bigrams"
nltk_tokens = word_tokenize(sen) #using tokenize from NLKT and not split() because split() does not take into account punctuation
#splitting sentence into bigrams and trigrams
print(list(bigrams(nltk_tokens)))
print(list(trigrams(nltk_tokens)))
#creating a dictionary that shows occurances of n-grams in text