In [1]:
get_ipython().ast_node_interactivity = 'all'
import os
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
from pathlib import Path
import json
In [18]:
comments = []

for path in Path("/home/leo/external/projects/comments/comments").glob("*.json"):
    obj = json.loads(path.read_text())
    encoded = json.dumps([
        obj["url"],
        obj["headers"].get("X-Real-Ip"),
        obj["headers"].get("Cdn-Requestcountrycode"),
        obj["headers"].get("Referer"),
        obj["headers"].get("User-Agent"),
        obj["text"],
    ])
    comments.append(encoded.upper())
In [19]:
print(comments[0])
Out:
["/BLOG/INDEX.HTML", "46.161.11.197", "GB", "HTTPS://WWW.GKBRK.COM/BLOG/INDEX.HTML", "MOZILLA/5.0 (WINDOWS NT 10.0; WIN64; X64) APPLEWEBKIT/537.36 (KHTML, LIKE GECKO) CHROME/83.0.4103.61 SAFARI/537.36/IYA9HEBN-7", "FINANCIAL ROBOT IS YOUR SUCCESS FORMULA IS FOUND. LEARN MORE ABOUT IT. HTTPS://BIG.STARTUPERS.SE/GOTODATE/GO "]
In [4]:
import torch
In [5]:
class TextHasher(torch.nn.Module):
    def __init__(self):
        super().__init__()

        self.encoder = torch.nn.Sequential(
            torch.nn.Linear(nf(1), 2),
            torch.nn.Tanh(),
        )

        self.decoder = torch.nn.Sequential(
            Compressor(2, nf(1)),
        )

    def forward(self, x):
        x = self.encoder(x)
        x = self.decoder(x)
        return x
Out:
[ERROR] SyntaxError: incomplete input (2052264714.py, line 1)