<jupyter_start><jupyter_text>Note: the list of philosopher is taken from here https://sv.wikipedia.org/wiki/Lista_%C3%B6ver_filosofer then cleaned up to include only the last name.Note 2: this is just an example and should be interpreted carefully.<jupyter_code># Connect the database

conn = sqlite3.connect("flashback_filosofi.sqlite3")
# Make dataframe and parse date and time correctly

df = pd.read_sql_query("SELECT * FROM fb", conn)
print(str(len(df)), "data points.") 
df.time = pd.to_datetime(df.time, format='%H:%M')
df.date = pd.to_datetime(df.date, format='%Y-%m-%d')
df.head()
# Just plot the posts on a 24h time scale

fig = plt.figure(figsize=(30,14))
ax = fig.add_subplot(111)
plt.plot(df['time'], 'rx')
# Create a list of philosopher names (Swedish variants)
filosofer = []
with open("filosofer.txt", "r") as filolist:
    filonamn = filolist.readlines()
    for f in filonamn:
        if " " not in f:
            filosofer.append(f.strip("\n"))
        else:
            if " " in f.strip("\n"):
                splitname = f.split(" ")
                filosofer.append((splitname[-1].strip("\n")))

#print(filosofer)
# Make a list of philosophers found in the forum body

citedphilosophers = [] 
for text in df.body:
    for filosof in filosofer:
        if filosof in text:
            citedphilosophers.append(filosof)
# Find most cited philosophers

counter = 1
for name in Counter(citedphilosophers).most_common(100):
    print(str(counter), name[0], "\t", name[1])
    counter += 1
# Find spelling variants of Nietzsche

correctspelling = 0
otherspelling = 0
for text in df.body:
    nietzchespelling = re.findall("Nie......", text)
    for n in nietzchespelling:
        if n == "Nietzsche":
            correctspelling +=1
        else:
            otherspelling +=1
            print(n)
print("Correct: ", str(correctspelling))
print("Wrong: ", str(otherspelling))
print("Correct quota: ", str(correctspelling / (correctspelling + otherspelling) * 100))
# Find the "-ism" suffix

ismer = []
ismcounter = 1

for text in df.body:
    ism = re.findall("\w+ism", text, re.IGNORECASE)
    if ism:
        for i in ism:
            ismer.append(i.lower())
        
for ism in Counter(ismer).most_common(100):
    print(str(ismcounter), ism[0], "\t", ism[1])
    ismcounter += 1
# Find the copula form.

ansker = []
anskcounter = 1

for text in df.body:
    ansk = re.findall(r"\w+istisk\b", text, re.IGNORECASE)
    if ansk:
        for a in ansk:
            ansker.append(a.lower())
#print(ansker)
for ansk in Counter(ansker).most_common(100):
    print(str(anskcounter), ansk[0], "\t", ansk[1])
    anskcounter += 1
# find out the most common outgoing links

links = []
for b in df.body:
    urls = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', b)
    if urls:
        for u in urls:
            links.append(u)            
for a, b in Counter(links).most_common(20):
    print(a, b)<jupyter_output>http://en.wikipedia.org 109
http://sv.wikipedia.org 40
http://www.counter-currents.com 29
http://plato.stanford.edu 29
https://www.flashback.org 24
http://www.youtube.com 22
https://www.youtube.com 17
https://en.wikipedia.org 17
http://www.dn.se 7
http://www.mphy.lu.se 5
http://www.theguardian.com 5
http://www.toqonline.com 5
http://books.google.se 5
http://www.ditext.com 5
http://www.adlibris.com 5
http://www.svd.se 5
http://www.samharris.org 4
http://sverigesradio.se 4
http://www.seedwiki.com 4
http://foucault.info 4
{'fraction_non_alphanumeric': 0.15075231481481483, 'fraction_numerical': 0.021701388888888888, 'mean_word_length': 3.1105826397146252, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 13, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '166180', 'license': 'MIT', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1223, 'n_words': 318, 'path': 'flashback_data_analysis/filosofer.ipynb', 'repo_name': 'bengan/flashbackscraper', 'size': '3456'}