Closed ShaliniR11 closed 2 years ago
Hi @ShaliniR11 , Thank you for your interest in our work!
.java
files into .c2v
files that the model can load.--no_hash
flag by changinng the following lines https://github.com/tech-srl/code2vec/blob/master/JavaExtractor/extract.py#L28-L30
into:
command = ['java', '-cp', args.jar, 'JavaExtractor.App',
'--max_path_length', str(args.max_path_length), '--max_path_width', str(args.max_path_width),
'--dir', dir, '--num_threads', str(args.num_threads), '--no_hash']
However, notice that the models provided by us in this repository were already trained with hashed paths. So, you will need to re-run the preprocessing step and re-train a model without hashing.
Best, Uri
Thank You for the quick response! I also wanted to know, the code2vec model generates all of these AST paths for a given code and it would also select the AST path with the highest attention right. Is there a way I could extract this AST path(the one with highest attention) separately for a given snippet of code?
Not exactly, it does not "select" any AST paths, it just uses all of them. The "selection" is implicit, by scoring them internally and weighting them according to their score.
Regarding extracting the top-attended AST paths: Did you try this part of the README? https://github.com/tech-srl/code2vec#step-4-manual-examination-of-a-trained-model ? I think it implements what you are looking for.
thank you !!
Hi Dr. Alon, I am doing a research at my university and we are trying to use the Code2Vec model. Can you please answer the following questions for me: