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
from neo4j import GraphDatabase | |
import tweepy | |
import json | |
# Connect To DataBase Neo4j | |
uri = "bolt://localhost:7687" | |
driver = GraphDatabase.driver(uri, auth=("neo4j", "twitterdata")) | |
consumer_key = "consumer_key" | |
consumer_secret = "consumer_secret" | |
access_token = "access_token" |
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
def ngram_string(string, n=3, remove_space=False): | |
if remove_space: | |
string = string.replace(' ', '') | |
if len(string) < n: | |
return {string: 1} | |
ngrams = dict() | |
for i in range(len(string)-n+1): | |
ngram = string[i:i+n] |