← Back to Blog
Download Notebook (.ipynb)

R_001 — Environment Sanity Check

Purpose: verify the repo environment is runnable and basics work.
Outputs: package versions + a simple plot.

import sys, platform
print("python:", sys.version.split()[0])
print("platform:", platform.platform())

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

print("numpy:", np.__version__)
print("pandas:", pd.__version__)
print("matplotlib:", plt.matplotlib.__version__)
df = pd.DataFrame({
    "x": [1, 2, 3, 4, 5],
    "y": [1, 4, 9, 16, 25],
})
df
plt.figure()
plt.plot(df["x"], df["y"], marker="o")
plt.title("Sanity check plot")
plt.xlabel("x")
plt.ylabel("y")
plt.show()
import sys
from pathlib import Path

repo_root = Path.cwd()
# 如果你在 LABS/notebooks 里运行,repo_root 是 notebooks,需要上两级
if (repo_root / "LABS").exists() is False:
    repo_root = repo_root.parent.parent

sys.path.insert(0, str(repo_root))

from LABS.src.text_chunker import chunk_text

sample = "Hello world! " * 80
chunks = chunk_text(sample, chunk_size=60, overlap=10)
len(chunks), chunks[0]