Sample

Schnappinger/jsweet/def.dom.TextEvent

Human rating uses the original dataset scale.

Human3.97
Lines20

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
64.9Δ 17.8
Scalabrino0.6320–1; higher is more readable
27.1Δ 55.6
Dorn0.0260–1; higher is more readable
24.4Δ 58.3
Mi0.1730–1; higher is more readable
13.5Δ 69.1
LLOC16Logical lines; fewer is more readable
64.9Δ 17.8
DeepSeek V4 Pro14.670–20; mean of three runs
34.8Δ 47.9
GPT-6.1 Sol16.330–20; mean of three runs
45.9Δ 36.8
BTTF0.5510–1; higher is more readable
50.8Δ 31.8
Human3.971–4; original rating
82.7

Views

Source code

package def.dom; public class TextEvent extends UIEvent { public String data; public double inputMethod; public String locale; native public void initTextEvent(String typeArg, Boolean canBubbleArg, Boolean cancelableArg, Window viewArg, String dataArg, double inputMethod, String locale); public double DOM_INPUT_METHOD_DROP; public double DOM_INPUT_METHOD_HANDWRITING; public double DOM_INPUT_METHOD_IME; public double DOM_INPUT_METHOD_KEYBOARD; public double DOM_INPUT_METHOD_MULTIMODAL; public double DOM_INPUT_METHOD_OPTION; public double DOM_INPUT_METHOD_PASTE; public double DOM_INPUT_METHOD_SCRIPT; public double DOM_INPUT_METHOD_UNKNOWN; public double DOM_INPUT_METHOD_VOICE; public static TextEvent prototype; public TextEvent(){} }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.550.016−18.151
Source linesThe number of non-empty source lines.20+8
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.991−7.487

Intercept 8.87 + feature contributions = -8.768 (log-odds).
Score = sigmoid(-8.768) = 0.

Score0.632

Feature contributions

FeatureValueContribution
(log-odds)
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.164.952−3.322
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Indentation frequencyHow rapidly indentation changes from line to line.1−0.703
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.039+0.559
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.21+0.293
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.19.777−0.133

Intercept 0.07 + feature contributions = -3.642 (log-odds).
Score = sigmoid(-3.642) = 0.026.

Score0.173
Score16
Run 1

The code is straightforward and easy to understand due to its simple, flat structure. It follows a consistent pattern of declaring public fields and a native method, making the intent clear. There is no deep nesting, and each field declaration is on its own line, which aids readability. However, the code is somewhat verbose due to the many similar constant declarations, and it lacks comments or documentation, which could make the purpose of the constants less clear. The constructor and prototype declaration are standard, but the overall organization could be improved by grouping related constants or adding explanatory comments. The reading flow is logical but not particularly optimized for quick comprehension.

Run 2

The code is logically organized and flat, with one member per line, which aids readability. However, clarity of intent is reduced by the generic 'def.dom' package and lack of comments explaining the event's purpose. Method parameters and constants use partially unclear names, such as 'data' and 'inputMethod'. Code length is concise, but the empty constructor and static 'prototype' field are boilerplate-like, slightly reducing reading flow.

Run 3

The code is a simple class definition with a clear structure. Fields are grouped logically (instance state, then constants, then static/prototype). Indentation is consistent and the class is flat with no nested blocks. Intent is straightforward: define a DOM TextEvent with associated constants and a native initializer. Action granularity is one field/method per line, aiding scanability. However, readability is slightly reduced by the use of primitive types (String, double, Boolean) where enums or more descriptive types might clarify intent, and by the lack of comments explaining the meaning of DOM_INPUT_METHOD_* constants. The constructor is empty but minimally acceptable. Overall, the code is concise and easy to read for a platform API binding, though it assumes familiarity with DOM event specifications.

Run 1

Code Structure: A straightforward class declaration groups event data, an initializer, input-method fields, and construction, though spacing would make these groups clearer. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive names and inheritance communicate its purpose, but the input-method fields resemble constants without being declared static final. Code length: Concise, with little unnecessary code, although the initializer signature is long. Action granularity: Each declaration occupies its own line, avoiding bundled actions. Reading flow: Generally natural, but the unwrapped method signature, lack of blank lines, unconventional modifier order, and tightly formatted empty constructor reduce readability.

Run 2

Code Structure: A straightforward class declaration, though grouping instance fields, input-method constants, and static members more distinctly would improve organization. Nesting: Minimal nesting makes scanning easy. Clarity of intent: The class and most member names clearly describe a text-event binding, but the native method lacks documentation, and constant-like fields are mutable doubles rather than explicit constants. Code length: Concise, with no unnecessary implementation. Action granularity: Each declaration occupies its own line, although the long method signature is harder to scan. Reading flow: Generally natural, but missing blank lines between logical groups, unconventional modifier order, and the tightly formatted empty constructor reduce polish.

Run 3

Code Structure: A straightforward class declaration, though grouping input-method constants separately from instance fields would improve organization. Nesting: Minimal, with only the class body and an empty constructor. Clarity of intent: The TextEvent name, inheritance, and descriptive fields communicate purpose; however, uppercase input-method fields look like constants but are neither static nor final. Code length: Concise, with no unnecessary implementation. Action granularity: Each declaration occupies its own line, although the long initTextEvent signature would benefit from multiline formatting. Reading flow: Generally natural, but blank lines between fields, the native method, constants, and constructor would make scanning easier.