microsoft / CodeBERT

CodeBERT
MIT License
2.25k stars 460 forks source link

Unixcoder, multiple masked token predicition #282

Open lyriccoder opened 1 year ago

lyriccoder commented 1 year ago

Hi guys.

Thank you for yor work.

I see that unixcoder can predict token.

1) How can I predict several tokens located in a different place?

Suppose, I have the code:

public DeleteDialogBot openDeleteDialog()
    {
        if ( browserBot.getTree().selectionCount() == 1 )
        {
            ContextMenuHelper.clickContextMenu( browserBot.getTree(), \"Delete Entry\" );
            return new DeleteDialogBot( DeleteDialogBot.DELETE_ENTRY_TITLE );
        }
    }

Wll be the following input correct if I need predict the same variable ,but located in different place?

public DeleteDialogBot openDeleteDialog()
    {
        if ( <mask>.getTree().selectionCount() == 1 )
        {
            ContextMenuHelper.clickContextMenu( <mask>.getTree(), \"Delete Entry\" );
            return new DeleteDialogBot( DeleteDialogBot.DELETE_ENTRY_TITLE );
        }
    }

2) How can I predict several different tokens located in a different place? Suppose, I have the code:

public DeleteDialogBot openDeleteDialog()
    {
        if ( browserBot.getTree().selectionCount() == 1 )
        {
            ContextMenuHelper.clickContextMenu( browserBot.getTree(), \"Delete Entry\" );
            return new DeleteDialogBot( DeleteDialogBot.DELETE_ENTRY_TITLE );
        }
    }

I need to predict 2 tokens (browserBot, located in 2 places) and also DeleteDialogBot, but I need to put into a single input? How can I do it?

public <WHAT SHOULD I PUT HERE>openDeleteDialog()
    {
        if ( <mask>.getTree().selectionCount() == 1 )
        {
            ContextMenuHelper.clickContextMenu( <mask>.getTree(), \"Delete Entry\" );
            return new DeleteDialogBot( <WHAT SHOULD I PUT HERE>.DELETE_ENTRY_TITLE );
        }
    }
guoday commented 1 year ago

public DeleteDialogBot openDeleteDialog() { if ( <mask0>.getTree().selectionCount() == 1 ) { ContextMenuHelper.clickContextMenu( <mask1>.getTree(), \"Delete Entry\" ); return new DeleteDialogBot( DeleteDialogBot.DELETE_ENTRY_TITLE ); } }

using <mask1>, <mask2>,...,<maskn>