{"id":{"repo_id":"ubc","oai_identifier":"oai:circle.library.ubc.ca:2429/83640"},"canonical_url":"https://search.ndltd.org/etd/ubc/oai:circle.library.ubc.ca:2429/83640","repository":{"repo_id":"ubc","name":"University of British Columbia","base_url":"http://circle.library.ubc.ca/oai/request"},"display":{"title":"Code comment generation by incorporating pre-defined application programming interface documentation","abstract":"Code comments are significantly helpful in comprehending software programs and, therefore, saving a lot of time and energy in software maintenance. However, the comments are mostly outdated or missed, specially in complex software projects. As a result, several automatic comment generation models are developed as a solution. These models aim to automatically predict comments in the natural language given a code snippet. Recently, several studies investigate the effect of integrating external knowledge on the quality of generated comments. In this work, we propose a solution, namely APIContext2Com, to improve the effectiveness of generated comments by incorporating the pre-defined Application Programming Interface (API) context. The API context includes the definition and description of the pre-defined APIs used within the code snippets. Since the API information expresses the functionality of a code snippet, it can be helpful to better generate the code summary. We introduce a seq-2-seq encoder-decoder neural network model with different sets of multiple encoders to effectively transform distinct inputs into target comments. A ranking mechanism is also developed to exclude less relevant APIs, so that we can filter out some unrelated knowledge to the model. We evaluate the proposed approach on large-scale Java dataset, containing over 130,000 records, and the experimental findings reveal that the proposed model significantly outperforms the competitive baselines. Compared to the best baseline, Rencos, the proposed approach improves BLEU1, BLEU2, BLEU3, BLEU4, METEOR, ROUGE-L scores by 1.88 (8.24 %), 2.16 (17.58 %), 1.38 (18.3 %), 0.73 (14.17 %), 1.58 (14.98 %) and 1.9 (6.92 %) respectively.","abstract_html":"Code comments are significantly helpful in comprehending software programs and, therefore, saving a lot of time and energy in software maintenance. However, the comments are mostly outdated or missed, specially in complex software projects. As a result, several automatic comment generation models are developed as a solution. These models aim to automatically predict comments in the natural language given a code snippet. Recently, several studies investigate the effect of integrating external knowledge on the quality of generated comments. In this work, we propose a solution, namely APIContext2Com, to improve the effectiveness of generated comments by incorporating the pre-defined Application Programming Interface (API) context. The API context includes the definition and description of the pre-defined APIs used within the code snippets. Since the API information expresses the functionality of a code snippet, it can be helpful to better generate the code summary. We introduce a seq-2-seq encoder-decoder neural network model with different sets of multiple encoders to effectively transform distinct inputs into target comments. A ranking mechanism is also developed to exclude less relevant APIs, so that we can filter out some unrelated knowledge to the model. We evaluate the proposed approach on large-scale Java dataset, containing over 130,000 records, and the experimental findings reveal that the proposed model significantly outperforms the competitive baselines. Compared to the best baseline, Rencos, the proposed approach improves BLEU1, BLEU2, BLEU3, BLEU4, METEOR, ROUGE-L scores by 1.88 (8.24 %), 2.16 (17.58 %), 1.38 (18.3 %), 0.73 (14.17 %), 1.58 (14.98 %) and 1.9 (6.92 %) respectively.","abstract_has_math":false,"creators":["Shahbazi, Ramin"],"institution":"University of British Columbia","degree_name":"Master of Science - MSc","degree_level":"master's","degree_discipline":"Computer Science","degree_department":null,"school":null,"contributors":["Fard, Fatemeh Hendijani"],"advisors":[],"committee_chairs":[],"committee_members":[],"year":2023,"date_issued":"2023","date_published":"2023","updated_at":"2026-11-19T15:13:24Z","subjects":[],"languages":["eng"],"rights":["Attribution-NonCommercial-NoDerivatives 4.0 International"],"rights_urls":["http://creativecommons.org/licenses/by-nc-nd/4.0/"],"identifier_entries":[],"person_identifier_entries":[]},"links":{"outbound_url":"http://hdl.handle.net/2429/83640","outbound_label":"Handle","outbound_source":"dc:identifier","record_url":"http://hdl.handle.net/2429/83640","record_label":"Repository record","record_kind":"handle","record_source":"dc:identifier","download_url":"http://circle.library.ubc.ca/bitstream/2429/83640/6/ubc_2023_february_shahbazi_ramin.pdf","download_label":"Download PDF","download_source":"dc:identifier","access_status":null,"embargo_until":null,"access_note":null},"source_record":{"url":"http://circle.library.ubc.ca/oai/request?verb=GetRecord&metadataPrefix=etdms&identifier=oai%3Acircle.library.ubc.ca%3A2429%2F83640","prefix":"etdms"},"metadata_groups":[{"id":"people","label":"People","entries":[{"key":"dc:contributor","label":"Contributor","values":["Fard, Fatemeh Hendijani"]},{"key":"dc:creator","label":"Author","values":["Shahbazi, Ramin"]}]},{"id":"academic_context","label":"Academic Context","entries":[{"key":"dc:date","label":"Dc Date","values":["2023"]},{"key":"dc:publisher","label":"Institution","values":["University of British Columbia"]},{"key":"dc:type","label":"Dc Type","values":["Text"]},{"key":"thesis:degree_discipline","label":"Discipline","values":["Computer Science"]},{"key":"thesis:degree_level","label":"Degree Level","values":["master's"]},{"key":"thesis:degree_name","label":"Degree Name","values":["Master of Science - MSc"]},{"key":"thesis:institution_name","label":"Thesis Institution Name","values":["University of British Columbia"]}]},{"id":"language_rights","label":"Language and Rights","entries":[{"key":"dc:language","label":"Dc Language","values":["eng"]},{"key":"dc:rights","label":"Dc Rights","values":["http://creativecommons.org/licenses/by-nc-nd/4.0/","Attribution-NonCommercial-NoDerivatives 4.0 International"]}]},{"id":"identifiers","label":"Identifiers","entries":[{"key":"dc:identifier","label":"Identifier","values":["http://hdl.handle.net/2429/83640","http://circle.library.ubc.ca/bitstream/2429/83640/6/ubc_2023_february_shahbazi_ramin.pdf"]}]},{"id":"additional","label":"Additional Metadata","entries":[{"key":"dc:description","label":"Description","values":["Code comments are significantly helpful in comprehending software programs and, therefore, saving a lot of time and energy in software maintenance. However, the comments are mostly outdated or missed, specially in complex software projects. As a result, several automatic comment generation models are developed as a solution. These models aim to automatically predict comments in the natural language given a code snippet. Recently, several studies investigate the effect of integrating external knowledge on the quality of generated comments. In this work, we propose a solution, namely APIContext2Com, to improve the effectiveness of generated comments by incorporating the pre-defined Application Programming Interface (API) context. The API context includes the definition and description of the pre-defined APIs used within the code snippets. Since the API information expresses the functionality of a code snippet, it can be helpful to better generate the code summary. We introduce a seq-2-seq encoder-decoder neural network model with different sets of multiple encoders to effectively transform distinct inputs into target comments. A ranking mechanism is also developed to exclude less relevant APIs, so that we can filter out some unrelated knowledge to the model. We evaluate the proposed approach on large-scale Java dataset, containing over 130,000 records, and the experimental findings reveal that the proposed model significantly outperforms the competitive baselines. Compared to the best baseline, Rencos, the proposed approach improves BLEU1, BLEU2, BLEU3, BLEU4, METEOR, ROUGE-L scores by 1.88 (8.24 %), 2.16 (17.58 %), 1.38 (18.3 %), 0.73 (14.17 %), 1.58 (14.98 %) and 1.9 (6.92 %) respectively."]},{"key":"dc:format","label":"Dc Format","values":["1601976","application/pdf"]},{"key":"dc:title","label":"Title","values":["Code comment generation by incorporating pre-defined application programming interface documentation"]}]}],"canonical_facts":{"dc:contributor":["Fard, Fatemeh Hendijani"],"dc:creator":["Shahbazi, Ramin"],"dc:date":["2023"],"dc:description":["Code comments are significantly helpful in comprehending software programs and, therefore, saving a lot of time and energy in software maintenance. However, the comments are mostly outdated or missed, specially in complex software projects. As a result, several automatic comment generation models are developed as a solution. These models aim to automatically predict comments in the natural language given a code snippet. Recently, several studies investigate the effect of integrating external knowledge on the quality of generated comments. In this work, we propose a solution, namely APIContext2Com, to improve the effectiveness of generated comments by incorporating the pre-defined Application Programming Interface (API) context. The API context includes the definition and description of the pre-defined APIs used within the code snippets. Since the API information expresses the functionality of a code snippet, it can be helpful to better generate the code summary. We introduce a seq-2-seq encoder-decoder neural network model with different sets of multiple encoders to effectively transform distinct inputs into target comments. A ranking mechanism is also developed to exclude less relevant APIs, so that we can filter out some unrelated knowledge to the model. We evaluate the proposed approach on large-scale Java dataset, containing over 130,000 records, and the experimental findings reveal that the proposed model significantly outperforms the competitive baselines. Compared to the best baseline, Rencos, the proposed approach improves BLEU1, BLEU2, BLEU3, BLEU4, METEOR, ROUGE-L scores by 1.88 (8.24 %), 2.16 (17.58 %), 1.38 (18.3 %), 0.73 (14.17 %), 1.58 (14.98 %) and 1.9 (6.92 %) respectively."],"dc:format":["1601976","application/pdf"],"dc:identifier":["http://hdl.handle.net/2429/83640","http://circle.library.ubc.ca/bitstream/2429/83640/6/ubc_2023_february_shahbazi_ramin.pdf"],"dc:language":["eng"],"dc:publisher":["University of British Columbia"],"dc:rights":["http://creativecommons.org/licenses/by-nc-nd/4.0/","Attribution-NonCommercial-NoDerivatives 4.0 International"],"dc:title":["Code comment generation by incorporating pre-defined application programming interface documentation"],"dc:type":["Text"],"thesis:degree_discipline":["Computer Science"],"thesis:degree_level":["master's"],"thesis:degree_name":["Master of Science - MSc"],"thesis:institution_name":["University of British Columbia"]},"updated_at":"2026-11-19T15:13:24Z"}