Logical code sections partition source by semantic structure instead of arbitrary line boundaries. A section may describe a class declaration, field declarations, or a complete method with its containing code, preserving useful context for dataset entries. section 12.2.1
Use the technique to balance detail against context:
- Avoid line-by-line slicing when isolated lines provide insufficient context for instructions and expected outputs. section 12.2.1
- Extract sections by parsing the Java class structure, then query the resulting semantic tree. section 12.2.1
- Accept greater parsing complexity when contextual sections produce more useful fine-tuning data. section 12.2.1
Class and method entries
A dataset can pair an instruction asking for a class declaration with the declaration itself, or ask how a setup method works and return the complete method. Each entry represents a meaningful code unit rather than one line. section 12.2.1
{"instruction": "What is the class declaration for
➥BrandingServiceIT","output": "@ExtendWith
➥@SpringBootTest
➥@ActiveProfiles
public class BrandingServiceIT { }"}
{"instruction": "How does the method setup Restito work for
➥BrandingServiceIT?","output": "
➥@BeforeEach
➥public void setupRestito(){
➥whenHttp(server).match(post("/auth/validate"))
➥.then(status(HttpStatus.OK_200));
➥}"}
Browse representative instruction-and-output pairs for class declarations and complete setup methods. section 12.2.1
