Skip to content

Instantly share code, notes, and snippets.

View muddy-28's full-sized avatar
🎯
Focusing

Adnan Shafique muddy-28

🎯
Focusing
View GitHub Profile
@muddy-28
muddy-28 / Convert-csv-to-associated-Array.php
Last active July 16, 2016 18:17
Convert a comma separated file into an associated Array | Eagale Solutions
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Function Parameters:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@muddy-28
muddy-28 / downloadFileChunks.php
Created June 9, 2016 10:34 — forked from irazasyed/downloadFileChunks.php
PHP: File downloader function - Downloading files in chunks.
<?php
/**
* Download helper to download files in chunks and save it.
*
* @author Syed I.R <[email protected]>
* @link https://github.com/irazasyed
*
* @param string $srcName Source Path/URL to the file you want to download
* @param string $dstName Destination Path to save your file
* @param integer $chunkSize (Optional) How many bytes to download per chunk (In MB). Defaults to 1 MB.
<?php
function get_url_contents($url){
if (function_exists('file_get_contents')) {
$result = @file_get_contents($url);
}
if ($result == '') {
$ch = curl_init();
$timeout = 30;
curl_setopt($ch, CURLOPT_URL, $url);
#-*- coding: utf-8 -*-
import re
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk import bigrams, trigrams
import math
stopwords = nltk.corpus.stopwords.words('portuguese')