This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): |