{"id":{"repo_id":"calgary","oai_identifier":"oai:ucalgary.scholaris.ca:1880/126189"},"canonical_url":"https://search.ndltd.org/etd/calgary/oai:ucalgary.scholaris.ca:1880/126189","repository":{"repo_id":"calgary","name":"University of Calgary","base_url":"https://ucalgary.scholaris.ca/server/oai/request"},"display":{"title":"Context-Aware Structural Generalization for API Usage Pattern Mining","abstract":"Application programming interfaces (APIs) are essential for modern software development, but learning to use them correctly from documentation alone is often challenging. Automatic API usage template mining tools abstract real-world examples into reusable templates based on their abstract syntax tree (AST) structure, but they suffer from structural rigidity and produce templates that are often difficult for developers to read. This thesis documents the methodology developed to improve auto-matic API usage template generation. We detail initial exploratory attempts to resolve template fragmentation via hierarchical clustering, as well as in-vestigations into alternative clustering algorithms. While these approaches encountered significant challenges related to over-generalization, the find-ings directly informed the design of Context-Aware Structural Generalization (CASGard), the tool that arose from this exploration. CASGard integrates large language models (LLMs), specifically CodeBERT, into the structural mining pipeline to assess semantic similarity. By dynamically adjusting the structural merge threshold based on CodeBERT semantic distance, CASGard combines the precision of AST-based generalization with the contextual information provided by neural semantic embeddings. Furthermore, we introduce a post-processing pipeline designed to map generic, machine-generated placeholder variables back to meaningful, domain-specific names, significantly enhancing the practical usability of the templates. During the empirical evaluation, a significant data contamination bug was identified and resolved in the baseline ASGard implementation. Fol-lowing this correction, validated experiments across 35 real-world Java APIs demonstrate that CASGard reduces the rate of unrepresentable input files by 30% overall compared to the baseline, and case studies show the post-processing pipeline restoring readability to the resulting templates.","abstract_html":"Application programming interfaces (APIs) are essential for modern software development, but learning to use them correctly from documentation alone is often challenging. Automatic API usage template mining tools abstract real-world examples into reusable templates based on their abstract syntax tree (AST) structure, but they suffer from structural rigidity and produce templates that are often difficult for developers to read. This thesis documents the methodology developed to improve auto-matic API usage template generation. We detail initial exploratory attempts to resolve template fragmentation via hierarchical clustering, as well as in-vestigations into alternative clustering algorithms. While these approaches encountered significant challenges related to over-generalization, the find-ings directly informed the design of Context-Aware Structural Generalization (CASGard), the tool that arose from this exploration. CASGard integrates large language models (LLMs), specifically CodeBERT, into the structural mining pipeline to assess semantic similarity. By dynamically adjusting the structural merge threshold based on CodeBERT semantic distance, CASGard combines the precision of AST-based generalization with the contextual information provided by neural semantic embeddings. Furthermore, we introduce a post-processing pipeline designed to map generic, machine-generated placeholder variables back to meaningful, domain-specific names, significantly enhancing the practical usability of the templates. During the empirical evaluation, a significant data contamination bug was identified and resolved in the baseline ASGard implementation. Fol-lowing this correction, validated experiments across 35 real-world Java APIs demonstrate that CASGard reduces the rate of unrepresentable input files by 30% overall compared to the baseline, and case studies show the post-processing pipeline restoring readability to the resulting templates.","abstract_has_math":false,"creators":["Askari, Majid"],"institution":"Science","degree_name":"Master of Science (MSc)","degree_level":null,"degree_discipline":"Computer Science","degree_department":null,"school":null,"contributors":[],"advisors":["Walker, Robert"],"committee_chairs":[],"committee_members":["Far, Behrouz","Alfadel, Mahmoud Abdulkarim"],"year":2026,"date_issued":"2026-09-15","date_published":"2026-09-15","updated_at":"2026-11-19T07:37:15Z","subjects":[],"languages":["en"],"rights":["Unless otherwise indicated, this material is protected by copyright and has been made available with authorization from the copyright owner. You may use this material in any way that is permitted by the Copyright Act or through licensing that has been assigned to the document. For uses that are not allowable under copyright legislation or licensing, you are required to seek permission."],"rights_urls":[],"identifier_entries":[{"key":"dc:identifier.uri","label":"Identifier URI","values":["https://hdl.handle.net/1880/126189"],"render_values":[{"text":"https://hdl.handle.net/1880/126189","href":"https://hdl.handle.net/1880/126189","code":true}]},{"key":"dc:identifier.citation","label":"Dc Identifier Citation","values":["Askari, M. (2026). Context-aware structural generalization for API usage pattern mining (Master's thesis, University of Calgary, Calgary, Canada). Retrieved from https://prism.ucalgary.ca."],"render_values":[{"text":"Askari, M. (2026). Context-aware structural generalization for API usage pattern mining (Master's thesis, University of Calgary, Calgary, Canada). Retrieved from https://prism.ucalgary.ca.","href":null,"code":true}]}],"person_identifier_entries":[]},"links":{"outbound_url":"https://doi.org/10.11575/PRISM/52083","outbound_label":"DOI","outbound_source":"dc:identifier.doi","record_url":"https://doi.org/10.11575/PRISM/52083","record_label":"Repository record","record_kind":"doi","record_source":"dc:identifier.doi","access_status":null,"embargo_until":null,"access_note":null},"oai_pmh_record":{"url":"https://union.ndltd.org/oai-pmh/?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai%3Aunion.ndltd.org%3Arepo%3Acalgary%3Aoai%3Aucalgary.scholaris.ca%3A1880%2F126189","prefix":"oai_dc"},"source_record":{"url":"https://ucalgary.scholaris.ca/server/oai/request?verb=GetRecord&metadataPrefix=dim&identifier=oai%3Aucalgary.scholaris.ca%3A1880%2F126189","prefix":"dim"},"metadata_groups":[{"id":"people","label":"People","entries":[{"key":"dc:contributor.advisor","label":"Advisor","values":["Walker, Robert"]},{"key":"dc:contributor.committeemember","label":"Committee Member","values":["Far, Behrouz","Alfadel, Mahmoud Abdulkarim"]},{"key":"dc:creator","label":"Author","values":["Askari, Majid"]}]},{"id":"academic_context","label":"Academic Context","entries":[{"key":"dc:date","label":"Dc Date","values":["2026-11"]},{"key":"dc:date.accessioned","label":"Dc Date Accessioned","values":["2026-09-23T19:20:17Z"]},{"key":"dc:date.issued","label":"Date","values":["2026-09-15"]},{"key":"dc:publisher.faculty","label":"Dc Publisher Faculty","values":["Science"]},{"key":"dc:type","label":"Dc Type","values":["master thesis"]},{"key":"thesis:degree_discipline","label":"Discipline","values":["Computer Science"]},{"key":"thesis:degree_name","label":"Degree Name","values":["Master of Science (MSc)"]},{"key":"thesis:release_request","label":"Thesis Release Request","values":["I do not require a thesis withhold – my thesis will have open access and can be viewed and downloaded publicly as soon as possible."]}]},{"id":"subjects_keywords","label":"Subjects and Keywords","entries":[{"key":"dc:subject.classification","label":"Dc Subject Classification","values":["Computer Science"]}]},{"id":"language_rights","label":"Language and Rights","entries":[{"key":"dc:language.iso","label":"Language (ISO)","values":["en"]},{"key":"dc:rights","label":"Dc Rights","values":["Unless otherwise indicated, this material is protected by copyright and has been made available with authorization from the copyright owner. You may use this material in any way that is permitted by the Copyright Act or through licensing that has been assigned to the document. For uses that are not allowable under copyright legislation or licensing, you are required to seek permission."]}]},{"id":"identifiers","label":"Identifiers","entries":[{"key":"dc:identifier.citation","label":"Dc Identifier Citation","values":["Askari, M. (2026). Context-aware structural generalization for API usage pattern mining (Master's thesis, University of Calgary, Calgary, Canada). Retrieved from https://prism.ucalgary.ca."]},{"key":"dc:identifier.doi","label":"DOI","values":["https://dx.doi.org/10.11575/PRISM/52083"]},{"key":"dc:identifier.uri","label":"Identifier URI","values":["https://hdl.handle.net/1880/126189"]}]},{"id":"additional","label":"Additional Metadata","entries":[{"key":"dc:description.abstract","label":"Abstract","values":["Application programming interfaces (APIs) are essential for modern software development, but learning to use them correctly from documentation alone is often challenging. Automatic API usage template mining tools abstract real-world examples into reusable templates based on their abstract syntax tree (AST) structure, but they suffer from structural rigidity and produce templates that are often difficult for developers to read. This thesis documents the methodology developed to improve auto-matic API usage template generation. We detail initial exploratory attempts to resolve template fragmentation via hierarchical clustering, as well as in-vestigations into alternative clustering algorithms. While these approaches encountered significant challenges related to over-generalization, the find-ings directly informed the design of Context-Aware Structural Generalization (CASGard), the tool that arose from this exploration. CASGard integrates large language models (LLMs), specifically CodeBERT, into the structural mining pipeline to assess semantic similarity. By dynamically adjusting the structural merge threshold based on CodeBERT semantic distance, CASGard combines the precision of AST-based generalization with the contextual information provided by neural semantic embeddings. Furthermore, we introduce a post-processing pipeline designed to map generic, machine-generated placeholder variables back to meaningful, domain-specific names, significantly enhancing the practical usability of the templates. During the empirical evaluation, a significant data contamination bug was identified and resolved in the baseline ASGard implementation. Fol-lowing this correction, validated experiments across 35 real-world Java APIs demonstrate that CASGard reduces the rate of unrepresentable input files by 30% overall compared to the baseline, and case studies show the post-processing pipeline restoring readability to the resulting templates."]},{"key":"dc:title","label":"Title","values":["Context-Aware Structural Generalization for API Usage Pattern Mining"]},{"key":"others:access_status","label":"Others Access Status","values":["open.access"]}]}],"canonical_facts":{"dc:contributor.advisor":["Walker, Robert"],"dc:contributor.committeemember":["Far, Behrouz","Alfadel, Mahmoud Abdulkarim"],"dc:creator":["Askari, Majid"],"dc:date":["2026-11"],"dc:date.accessioned":["2026-09-23T19:20:17Z"],"dc:date.issued":["2026-09-15"],"dc:description.abstract":["Application programming interfaces (APIs) are essential for modern software development, but learning to use them correctly from documentation alone is often challenging. Automatic API usage template mining tools abstract real-world examples into reusable templates based on their abstract syntax tree (AST) structure, but they suffer from structural rigidity and produce templates that are often difficult for developers to read. This thesis documents the methodology developed to improve auto-matic API usage template generation. We detail initial exploratory attempts to resolve template fragmentation via hierarchical clustering, as well as in-vestigations into alternative clustering algorithms. While these approaches encountered significant challenges related to over-generalization, the find-ings directly informed the design of Context-Aware Structural Generalization (CASGard), the tool that arose from this exploration. CASGard integrates large language models (LLMs), specifically CodeBERT, into the structural mining pipeline to assess semantic similarity. By dynamically adjusting the structural merge threshold based on CodeBERT semantic distance, CASGard combines the precision of AST-based generalization with the contextual information provided by neural semantic embeddings. Furthermore, we introduce a post-processing pipeline designed to map generic, machine-generated placeholder variables back to meaningful, domain-specific names, significantly enhancing the practical usability of the templates. During the empirical evaluation, a significant data contamination bug was identified and resolved in the baseline ASGard implementation. Fol-lowing this correction, validated experiments across 35 real-world Java APIs demonstrate that CASGard reduces the rate of unrepresentable input files by 30% overall compared to the baseline, and case studies show the post-processing pipeline restoring readability to the resulting templates."],"dc:identifier.citation":["Askari, M. (2026). Context-aware structural generalization for API usage pattern mining (Master's thesis, University of Calgary, Calgary, Canada). Retrieved from https://prism.ucalgary.ca."],"dc:identifier.doi":["https://dx.doi.org/10.11575/PRISM/52083"],"dc:identifier.uri":["https://hdl.handle.net/1880/126189"],"dc:language.iso":["en"],"dc:publisher.faculty":["Science"],"dc:rights":["Unless otherwise indicated, this material is protected by copyright and has been made available with authorization from the copyright owner. You may use this material in any way that is permitted by the Copyright Act or through licensing that has been assigned to the document. For uses that are not allowable under copyright legislation or licensing, you are required to seek permission."],"dc:subject.classification":["Computer Science"],"dc:title":["Context-Aware Structural Generalization for API Usage Pattern Mining"],"dc:type":["master thesis"],"others:access_status":["open.access"],"thesis:degree_discipline":["Computer Science"],"thesis:degree_name":["Master of Science (MSc)"],"thesis:release_request":["I do not require a thesis withhold – my thesis will have open access and can be viewed and downloaded publicly as soon as possible."]},"updated_at":"2026-11-19T07:37:15Z"}