Scientific Programming / 2019 / Article / Alg 2

Research Article

Software Defect Prediction via Attention-Based Recurrent Neural Network

Algorithm 2

Encoding ASTs’ string vectors.
Input: ASTs’ string vectors , the fixed length of each vector m;
Output: integer vectors ;
(1)Initialize a list V, a dict and a dict ;
(2)for do
(3)for do
(4)  if not in tokFreq.keys then
(5)   ;
(6)  end
(7)  ;
(8)end
(9)end
(10)Creating a list sorted in descending order of token frequency which contains tuples of each token and its corresponding frequency;
(11)for do
(12);
(13); // establishing a dict of the ordered tokens to map them into integers
(14)end
(15)for do
(16)for do
(17)  ;
(18)end
(19)if then
(20)  Adding 0s into ;
(21)end
(22)else if then
(23)  for do
(24)   ; // finding the index of the lowest token frequency ; // deleting the token
(25)  end
(26)end
(27) Adding into V;
(28)end
(29)return V;

We are committed to sharing findings related to COVID-19 as quickly and safely as possible. Any author submitting a COVID-19 paper should notify us at help@hindawi.com to ensure their research is fast-tracked and made available on a preprint server as soon as possible. We will be providing unlimited waivers of publication charges for accepted articles related to COVID-19. Sign up here as a reviewer to help fast-track new submissions.