数据集概述
数据集摘要
CodeXGLUE CodeCompletion-token 数据集用于预测给定上下文中下一个代码令牌。模型通过令牌级别的准确性进行评估。该数据集支持两种编程语言:Java 和 Python。
支持的任务和排行榜
language-modeling: 用于训练模型完成单个代码令牌。
语言
数据集结构
数据实例
Java
一个 test 样本示例如下:
json
{
"code": ["<s>", "package", "org", ".", "vaadin", ".", "teemu", ".", "clara", ".", "demo", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "ByteArrayInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStreamReader", ";", "import", "org", ".", "vaadin", ".", "teemu", ".", "clara", ".", "Clara", ";", "import", "org", ".", "vaadin", ".", "teemu", ".", "clara", ".", "inflater", ".", "LayoutInflaterException", ";", "import", "com", ".", "vaadin", ".", "Application", ";", "import", "com", ".", "vaadin", ".", "terminal", ".", "ThemeResource", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Button", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Button", ".", "ClickEvent", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Component", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Embedded", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "HorizontalLayout", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "HorizontalSplitPanel", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "TextArea", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "VerticalLayout", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Window", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Window", ".", "Notification", ";", "@", "SuppressWarnings", "(", ""serial"", ")", "public", "class", "DemoApplication", "extends", "Application", "{", "private", "DemoController", "controller", ";", "private", "TextArea", "xmlArea", ";", "private", "HorizontalSplitPanel", "split", "=", "new", "HorizontalSplitPanel", "(", ")", ";", "private", "Window", "mainWindow", ";", "@", "Override", "public", "void", "init", "(", ")", "{", "setTheme", "(", ""clara"", ")", ";", "setMainWindow", "(", "mainWindow", "=", "new", "Window", "(", ")", ")", ";", "controller", "=", "new", "DemoController", "(", "mainWindow", ")", ";", "mainWindow", ".", "setContent", "(", "split", ")", ";", "VerticalLayout", "editor", "=", "new", "VerticalLayout", "(", ")", ";", "editor", ".", "setSpacing", "(", "true", ")", ";", "editor", ".", "setMargin", "(", "false", ",", "false", ",", "false", ",", "true", ")", ";", "editor", ".", "setHeight", "(", ""100%"", ")", ";", "editor", ".", "addComponent", "(", "xmlArea", "=", "createXmlArea", "(", ")", ")", ";", "editor", ".", "setExpandRatio", "(", "xmlArea", ",", "1.0f", ")", ";", "editor", ".", "addComponent", "(", "createUpdateButton", "(", ")", ")", ";", "HorizontalLayout", "wrapper", "=", "new", "HorizontalLayout", "(", ")", ";", "wrapper", ".", "setMargin", "(", "true", ")", ";", "wrapper", ".", "setSizeFull", "(", ")", ";", "wrapper", ".", "addComponent", "(", "createLogo", "(", ")", ")", ";", "wrapper", ".", "addComponent", "(", "editor", ")", ";", "wrapper", ".", "setExpandRatio", "(", "editor", ",", "1.0f", ")", ";", "split", ".", "setFirstComponent", "(", "wrapper", ")", ";", "updateLayout", "(", ")", ";", "}", "private", "Component", "createLogo", "(", ")", "{", "Embedded", "logo", "=", "new", "Embedded", "(", "null", ",", "new", "ThemeResource", "(", """", ")", ")", ";", "logo", ".", "setHeight", "(", ""90px"", ")", ";", "logo", ".", "setWidth", "(", ""90px"", ")", ";", "return", "logo", ";", "}", "private", "TextArea", "createXmlArea", "(", ")", "{", "TextArea", "area", "=", "new", "TextArea", "(", ")", ";", "area", ".", "setStyleName", "(", ""xml-area"", ")", ";", "area", ".", "setSizeFull", "(", ")", ";", "area", ".", "setValue", "(", "readStartingPoint", "(", ")", ")", ";", "return", "area", ";", "}", "private", "Button", "createUpdateButton", "(", ")", "{", "return", "new", "Button", "(", ""Update"", ",", "new", "Button", ".", "ClickListener", "(", ")", "{", "public", "void", "buttonClick", "(", "ClickEvent", "event", ")", "{", "updateLayout", "(", ")", ";", "}", "}", ")", ";", "}", "private", "String", "readStartingPoint", "(", ")", "{", "BufferedReader", "reader", "=", "null", ";", "try", "{", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", """", ")", ")", ")", ";", "StringBuilder", "xml", "=", "new", "StringBuilder", "(", ")", ";", "String", "line", ";", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "xml", ".", "append", "(", "line", ")", ";", "xml", ".", "append", "(", ""n"", ")", ";", "}", "return", "xml", ".", "toString", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "if", "(", "reader", "!=", "null", ")", "{", "try", "{", "reader", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "return", "null", ";", "}", "private", "void", "updateLayout", "(", ")", "{", "try", "{", "Component", "c", "=", "Clara", ".", "create", "(", "new", "ByteArrayInputStream", "(", "xmlArea", ".", "getValue", "(", ")", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ",", "controller", ")", ";", "split", ".", "replaceComponent", "(", "split", ".", "getSecondComponent", "(", ")", ",", "c", ")", ";", "}", "catch", "(", "LayoutInflaterException", "e", ")", "{", "mainWindow", ".", "showNotification", "(", "e", ".", "getMessage", "(", ")", ",", "Notification", ".", "TYPE_ERROR_MESSAGE", ")", ";", "}", "}", "}", "</s>"],
"id": 0
}
Python
一个 train 样本示例如下:
json
{
"code": ["<s>", "from", "bootstrap", "import", "Bootstrap", "<EOL>", "from", "fund", "import", "InstantPaymentNotificationHandler", "<EOL>", "from", "fund", "import", "ThankYouHandler", "<EOL>", "from", "view", "import", "", "<EOL>", "mapping", "=", "[", "(", "<EOL>", "r/", ",", "<EOL>", "Index", "<EOL>", ")", ",", "(", "<EOL>", "r/ipn", ",", "<EOL>", "InstantPaymentNotificationHandler", "<EOL>", ")", ",", "(", "<EOL>", "r/thank-you", ",", "<EOL>", "ThankYouHandler", "<EOL>", ")", ",", "(", "<EOL>", "r/about/?", ",", "<EOL>", "About", "<EOL>", ")", ",", "(", "<EOL>", "r/guide/?", ",", "<EOL>", "Guide", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Download", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Standards", "<EOL>", ")", ",", "(", "<EOL>", "r/community/?", ",", "<EOL>", "Community", "<EOL>", ")", ",", "(", "<EOL>", "r/news/?", ",", "<EOL>", "News", "<EOL>", ")", ",", "(", "<EOL>", "r/support/?", ",", "<EOL>", "Support", "<EOL>", ")", ",", "(", "<EOL>", "r/contact/?", ",", "<EOL>", "Contact", "<EOL>", ")", ",", "(", "<EOL>", "r/press/?", ",", "<EOL>", "Press", "<EOL>", ")", ",", "(", "<EOL>", "r/legal/terms", ",", "<EOL>", "Terms", "<EOL>", ")", ",", "(", "<EOL>", "r/library/?", ",", "<EOL>", "Library", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Library", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Library", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Users", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "User", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Design", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Design", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Design", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Design", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Design", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "RedirectSuccess", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "RedirectError", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "RedirectAfterDelete", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Moderate", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Bootstrap", "<EOL>", ")", ",", "(", "<EOL>", "r/activity", ",", "<EOL>", "ActivityScreen", "<EOL>", ")", ",", "(", "<EOL>", "r/txns", ",", "<EOL>", "TxnList", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Base64Blob", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "Base64Blob", "<EOL>", ")", ",", "(", "<EOL>", "r", ",", "<EOL>", "MessageStrings", "<EOL>", ")", ",", "(", "<EOL>", "r/.", ",", "<EOL>", "NotFound", "<EOL>", ")", "<EOL>", "]", "</s>"],
"id": 0,
"path": "00/wikihouse/urls.py
"
}
数据字段
Java
| 字段名 |
类型 |
描述 |
| id |
int32 |
样本的索引 |
| code |
Sequence[string] |
代码令牌 |
Python
| 字段名 |
类型 |
描述 |
| id |
int32 |
样本的索引 |
| path |
string |
数据集中的原始路径 |
| code |
Sequence[string] |
代码令牌 |
数据分割
Java
|
train |
validation |
test |
| java |
12934 |
7189 |
8268 |
Python
|
train |
test |
| python |
100000 |
50000 |