WUT_Computer_Science/Programming
Krzysztof kuhy Rudnicki b017c7500e NLP: zero findings, and two real bugs found on the way
384 findings to none across ten scripts. Most of it is annotation and
docstring work, but the lint surfaced two defects that had nothing to do with
style:

- `gpt_chunks.py` stripped its GPT preamble with
  `input_string.strip("iSTS chunks:")`. str.strip takes a SET OF CHARACTERS,
  not a prefix, so it also ate any leading i/S/T/s/c/h/u/n/k/space/colon:
  "iSTS chunks: sentence one" came out as "entence one", silently losing the
  first letter of every chunked sentence. Now removeprefix. ruff found it as
  B005 + PLE1310.
- `is_numbered_line_format` had `for string in string` in its list branch,
  which raises NameError the moment a list is passed (F821).
- `processing.test_XML()` read a module-level `alignments_data` that does not
  exist at module scope; it only ever ran when pasted into a live session. It
  takes the data as an argument now and is renamed `log_first_alignment` so
  pytest stops collecting a non-test as a test.

Also real rather than cosmetic:

- The OpenAI key was a placeholder string literal in three files, one of them
  carrying a "Replace me with os.environ['API_KEY']" comment. All three read
  OPENAI_API_KEY now and say so when it is missing -- as committed, none of
  these scripts could actually run.
- `rating.rate_similarity` was submitted unfinished: it built a client, never
  touched its two arguments and returned None despite `-> str`. It now makes
  the same call the rest of the package makes.
- The two 2 kB alignment prompts and one 344-character chunking prompt moved
  to prompts/*.txt. Wrapping them in source would have put newlines into the
  middle of the prompt.
- `format_alignments` parsed GPT's replies with `eval()`; the file holds one
  repr()'d string per line, so ast.literal_eval is both sufficient and safe.
- NLP/__init__.py deleted -- it made the course directory a package named
  "NLP", which is an invalid module name (N999) and which nothing imports;
  the scripts use plain `import processing`.

INP001 is settled the same way throughout: a coursework file run as
`python x.py` gets a shebang and the executable bit, which is what it is,
rather than an __init__.py that would make a course code into a module name.

Verified: every module compiles and `./run.sh run Programming/NLP` is clean.
The scripts themselves need the SemEval corpus and a paid API key, so they
are not executed here.

Repo-wide: 3,159 findings -> 2,775.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
2026-08-28 20:13:19 +02:00
..
AIS Split 19 over-cap LaTeX reports, proving each PDF is unchanged 2026-08-28 19:47:12 +02:00
BD2 Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00
BSS Run all 33 safe courses; fix what that broke 2026-08-28 18:52:31 +02:00
E-PSYOPS Run all 33 safe courses; fix what that broke 2026-08-28 18:52:31 +02:00
EADS Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00
EARIN Hold the coursework to the same lint bar as the tooling 2026-08-28 19:53:04 +02:00
ECOAR Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00
ECOTE ECOTE and ECRYPT_PROJECT: zero findings, tests still green 2026-08-28 20:03:01 +02:00
ECRYPT Hold the coursework to the same lint bar as the tooling 2026-08-28 19:53:04 +02:00
ECRYPT_PROJECT ECOTE and ECRYPT_PROJECT: zero findings, tests still green 2026-08-28 20:03:01 +02:00
EGUI Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00
EOOP Run all 33 safe courses; fix what that broke 2026-08-28 18:52:31 +02:00
EOPSY Split 19 over-cap LaTeX reports, proving each PDF is unchanged 2026-08-28 19:47:12 +02:00
EPFU Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00
ERSMS-project Hold the coursework to the same lint bar as the tooling 2026-08-28 19:53:04 +02:00
NLP NLP: zero findings, and two real bugs found on the way 2026-08-28 20:13:19 +02:00
PBAD Hold the coursework to the same lint bar as the tooling 2026-08-28 19:53:04 +02:00
PORR Split 19 over-cap LaTeX reports, proving each PDF is unchanged 2026-08-28 19:47:12 +02:00
PSD Hold the coursework to the same lint bar as the tooling 2026-08-28 19:53:04 +02:00
psd_project Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00
TRAK Hold the coursework to the same lint bar as the tooling 2026-08-28 19:53:04 +02:00
twm_4 Hold the coursework to the same lint bar as the tooling 2026-08-28 19:53:04 +02:00
USD Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00
WDWR Hold the coursework to the same lint bar as the tooling 2026-08-28 19:53:04 +02:00
ZPOB Make ZPOB build: its essay was handed in without a bibliography 2026-08-28 19:18:11 +02:00