Skip to content

Instantly share code, notes, and snippets.

View amirinia's full-sized avatar
🏠
Working from home

Hossein Amirinia amirinia

🏠
Working from home
View GitHub Profile
@amirinia
amirinia / bag-of-word-vectors.py
Created March 19, 2020 04:43 — forked from edubey/bag-of-word-vectors.py
Code to generate bag of word vectors in Python
# import statments
import numpy
import re
'''
Tokenize each the sentences, example
Input : "John likes to watch movies. Mary likes movies too"
Ouput : "John","likes","to","watch","movies","Mary","likes","movies","too"
'''
def tokenize(sentences):
@amirinia
amirinia / Text-summarization.py
Created March 19, 2020 04:43 — forked from edubey/Text-summarization.py
Text Summarizer in Python
#!/usr/bin/env python
# coding: utf-8
from nltk.corpus import stopwords
from nltk.cluster.util import cosine_distance
import numpy as np
import networkx as nx
def read_article(file_name):
file = open(file_name, "r")