So maybe training a model against some really well documented codebases might help?
Perhaps unit tests are a also a must since proper unit tests force granularity, thus in theory you’d have a good description of what the intention was + small chunks of code to correlate with.
The issue tho is that most open source code is technical code and code that relies on it serves a business function.
Either way i think the key is finding well documented well tdd’d business function code. Even if what you wish to explain is not clean and tidy but certain bits may fit in patterns that make sense when individually fit against a model. If it makes sense.
"The issue tho is that most open source code is technical code and code that relies on it serves a business function." Wow yeah never thought about it in that way before!