wala / graph4code

GraphGen4Code: a toolkit for creating code knowledge graphs based on WALA code analysis and extraction of documentation and forum content.
https://wala.github.io/graph4code/
Eclipse Public License 2.0
231 stars 33 forks source link

how to get the file 'class.map' of my own environment #8

Closed LeeSureman closed 2 years ago

LeeSureman commented 2 years ago

Hello, I saw and read your paper "A Toolkit for Generating Code Knowledge Graphs" and think it is very nice and inspectful. And I try to run your code for extracting graph on my own code and experiment. Since your class.map corresponds to some libraries, I would like ask how I can get the class.map file of my own environment ?

ksrinivs64 commented 2 years ago

Hello did you try and run the analysis first and then generate top modules as outlined in the steps?

LeeSureman commented 2 years ago

Hello did you try and run the analysis first and then generate top modules as outlined in the steps?

sorry, I run the steps you provide, but fails in 'From the scripts dir, run: sh inspect_modules_for_docstrings.sh .", due to some elastic search related error.(my working labtop is not available now, I can provide it tomorrow).

ksrinivs64 commented 2 years ago

Ok sure - do let us know and we will try and help.

LeeSureman commented 2 years ago

Thank you for quick response!

ksrinivs64 commented 2 years ago

I think I misread your question - I'm assuming that you cannot re-use classes.map we have provided already? That has the normalized names for most commonly used Python classes.

LeeSureman commented 2 years ago

actually, I'm not sure whether the class.map is the result of mapping in your paper, such as "numpy.zeros.transpose -> numpy.ndarray.transpose"? it seems the mapping in class.map is about mapping of class instead of function

LeeSureman commented 2 years ago

maybe I misunderstood the class.map. I thought it is the mapping result of function calls.

LeeSureman commented 2 years ago

My main purpose is to figure out how you map function calls, like torch.zeros.max -> torch.Tensor.max, or str.strip.strip.split.append -> list.append? it seems how to get these mappings is not introduced in your paper. (If I miss it, I will apologize...) So I want to look into your code for understanding how you achieve it

ksrinivs64 commented 2 years ago

Ok what you are asking for is a normalized function call after type inference. Type inference is challenging in dynamic languages like Python as you may already know. We tried to use this graph to infer it but that is not part of this work. We have a separate piece of work on it (paper + code). If you are really interested in that we would need to spend some time packaging that all up. Do you want to work on that problem with us?

LeeSureman commented 2 years ago

Sorry for latency response. Yes, but I do not know the name of what I need. Now I need the behaviour like ctrl+left click in pycharm, when put the cursor on one function call or class, then pycharm will give the called things or called candidates when the called thing is not certain. I misunderstood your knowledge graph as a simple call/called graph. Since pycharm/vscode can do this thing, I think maybe there is an existing tool that can do this thing? I find some static analysis tool like Pylint, but it seems Pyling does not straightly support the function I need... If the pylint can do this thing, it can be enough for me, for me, I do not need a very very high accuracy. I do not want this small thing bother you for packaging your work all. And I'm not sure the type inference paper+code you mention is the function I mention...