File size: 2,422 Bytes
f211247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""mark.txt dosyalarının formatını keşfetmek için yardımcı script.
Kullanım: python3 inspect_mark.py
"""
import os
import json

MARK_PATH = "datasets/sources/hitit_local/32/mark.txt"

with open(MARK_PATH, "rb") as f:
    raw = f.read(5000)

print("=== İlk 500 byte (raw) ===")
print(raw[:500])
print()

# Encoding dene
for enc in ("utf-8", "utf-16", "latin-1"):
    try:
        text = raw.decode(enc)
        print(f"=== {enc} ile decode edildi, ilk 1000 karakter ===")
        print(text[:1000])
        print()

        # JSON mu diye kontrol et
        try:
            full = open(MARK_PATH, "r", encoding=enc).read()
            data = json.loads(full)
            print(f"=== JSON olarak parse edildi ({enc}) ===")
            if isinstance(data, dict):
                print("Tip: dict")
                print("Anahtarlar:", list(data.keys())[:20])
                for key in list(data.keys())[:5]:
                    val = data[key]
                    if isinstance(val, list):
                        print(f"  {key}: list, uzunluk={len(val)}")
                        if len(val) > 0:
                            print(f"    İlk eleman: {str(val[0])[:300]}")
                    elif isinstance(val, dict):
                        print(f"  {key}: dict, anahtarlar={list(val.keys())[:10]}")
                    else:
                        print(f"  {key}: {type(val).__name__} = {str(val)[:200]}")
            elif isinstance(data, list):
                print(f"Tip: list, uzunluk={len(data)}")
                if len(data) > 0:
                    print(f"İlk eleman tipi: {type(data[0]).__name__}")
                    print(f"İlk eleman: {str(data[0])[:500]}")
        except json.JSONDecodeError as e:
            print(f"JSON parse hatası ({enc}): {e}")
        except Exception as e:
            print(f"Hata ({enc}): {e}")
        break
    except UnicodeDecodeError:
        print(f"{enc} ile decode edilemedi")

# Dosya boyutu
size = os.path.getsize(MARK_PATH)
print(f"\nDosya boyutu: {size} byte ({size/1024:.1f} KB)")

# Tüm mark.txt dosyalarını listele ve boyutlarını göster
print("\n=== Tüm mark.txt dosyaları ===")
for root, dirs, files in os.walk("datasets" / "sources" / "hitit_local"):
    for f in files:
        if f == "mark.txt":
            path = os.path.join(root, f)
            size = os.path.getsize(path)
            print(f"  {path}: {size/1024:.1f} KB")