Giter Site home page Giter Site logo

Extract Path Contexts Only about code2seq HOT 5 CLOSED

Avv22 avatar Avv22 commented on June 21, 2024
Extract Path Contexts Only

from code2seq.

Comments (5)

urialon avatar urialon commented on June 21, 2024

from code2seq.

lyriccoder avatar lyriccoder commented on June 21, 2024

Seems @Avra2 wants to get paths.
Try to compile Java application inside the project or just find the compiled jar file.

You can run it with java -cp JavaExtractor/JPredict/target/JavaExtractor-0.0.2-SNAPSHOT.jar JavaExtractor.App --max_path_length=8 --max_path_width=2 --file filename, where filename is a file with a java function.

Suppose, you have the code:

public boolean f(Set<String> set, String value) 
{  
   for (String entry : set) 
   {  
       if (entry.equalsIgnoreCase(value)) 
       {  
           return true ;   
        }  
   }  
   return false;  
}

So, the code will be translated into the following list of paths:

set GenericClass1|Prm|Mth|Bk|Foreach|VDE|VD|VDID0 entry
METHOD_NAME Nm1|Mth|Prm|GenericClass1 set
set GenericClass1|Prm|Mth|Bk|Foreach|VDE|Cls0 string
set VDID0|Prm|GenericClass|Cls0 string
string Cls0|GenericClass|Prm|Mth|Bk|Foreach|VDE|VD|VDID0 entry
string Cls0|GenericClass|Prm|Mth|Prm|Cls1 string
set GenericClass|Cls0 string
set GenericClass1|Prm|Mth|Bk|Foreach|Nm1 set
string Cls0|GenericClass|Prm|Mth|Bk|Foreach|Nm1 set
boolean Prim0|Mth|Prm|GenericClass|Cls0 string
METHOD_NAME Nm1|Mth|Prm|GenericClass|Cls0 string
set GenericClass1|Prm|Mth|Prm|VDID0 value
set GenericClass1|Prm|Mth|Bk|Ret|BoolEx0 false
set GenericClass1|Prm|Mth|Bk|Foreach|Bk|If|Cal0|Nm3 equals|ignore|case
boolean Prim0|Mth|Prm|GenericClass1 set
string Cls0|GenericClass|Prm|Mth|Prm|VDID0 value
set GenericClass1|Prm|Mth|Bk|Foreach|Bk|If|Cal0|Nm2 value
set GenericClass1|Prm|Mth|Bk|Foreach|Bk|If|Cal0|Nm0 entry
set VDID0|Prm|GenericClass1 set
string Cls0|GenericClass|Prm|Mth|Bk|Ret|BoolEx0 false
string Cls0|GenericClass|Prm|Mth|Bk|Foreach|VDE|Cls0 string
set GenericClass1|Prm|Mth|Prm|Cls1 string

Did u want those lists of paths (you called it "path context")?

from code2seq.

Avv22 avatar Avv22 commented on June 21, 2024

@lyriccoder @urialon. Thanks for response. By path context, I don't refer to paths extracted by parser but aggregated path learned by your model by the help of attention mechanism as this should be "the most that contributes to method name" please? So can we use this "vector that the most that contributes to method name" as representation embedding for the whole file or this is just useful for your task, which is method name prediction? If this vector can be used for various tasks, then can you please show how to extract it from your network during training?

Thanks.

from code2seq.

urialon avatar urialon commented on June 21, 2024

from code2seq.

Avv22 avatar Avv22 commented on June 21, 2024

@urialon. Thank you.

from code2seq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.