Sample

Schnappinger/jsweet/def.dom.MSInputMethodContext

Human rating uses the original dataset scale.

Human3.27
Lines26

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
40.1Δ 4.5
Scalabrino0.4620–1; higher is more readable
6.2Δ 29.5
Dorn0.0160–1; higher is more readable
22.4Δ 13.2
Mi0.0020–1; higher is more readable
1.0Δ 34.7
LLOC22Logical lines; fewer is more readable
57.1Δ 21.5
DeepSeek V4 Pro8.670–20; mean of three runs
6.6Δ 29.0
GPT-6.1 Sol160–20; mean of three runs
38.9Δ 3.3
BTTF0.3440–1; higher is more readable
26.4Δ 9.2
Human3.271–4; original rating
35.6

Views

Source code

package def.dom; public class MSInputMethodContext extends EventTarget { public double compositionEndOffset; public double compositionStartOffset; public java.util.function.Function<Event,Object> oncandidatewindowhide; public java.util.function.Function<Event,Object> oncandidatewindowshow; public java.util.function.Function<Event,Object> oncandidatewindowupdate; public HTMLElement target; native public ClientRect getCandidateWindowClientRect(); native public String[] getCompositionAlternatives(); native public Boolean hasComposition(); native public Boolean isCandidateWindowVisible(); native public void addEventListener(jsweet.util.StringTypes.MSCandidateWindowHide type, java.util.function.Function<Event,Object> listener, Boolean useCapture); native public void addEventListener(jsweet.util.StringTypes.MSCandidateWindowShow type, java.util.function.Function<Event,Object> listener, Boolean useCapture); native public void addEventListener(jsweet.util.StringTypes.MSCandidateWindowUpdate type, java.util.function.Function<Event,Object> listener, Boolean useCapture); native public void addEventListener(String type, EventListener listener, Boolean useCapture); public static MSInputMethodContext prototype; public MSInputMethodContext(){} native public void addEventListener(jsweet.util.StringTypes.MSCandidateWindowHide type, java.util.function.Function<Event,Object> listener); native public void addEventListener(jsweet.util.StringTypes.MSCandidateWindowShow type, java.util.function.Function<Event,Object> listener); native public void addEventListener(jsweet.util.StringTypes.MSCandidateWindowUpdate type, java.util.function.Function<Event,Object> listener); native public void addEventListener(String type, EventListener listener); native public void addEventListener(String type, EventListenerObject listener, Boolean useCapture); native public void addEventListener(String type, EventListenerObject listener); }

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.2006.132−66.202
Source linesThe number of non-empty source lines.26+10.4
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.75−7.125

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

Score0.462

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.166−3.366
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
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.073+0.23
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.27+0.08
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.25.874−0.048

Intercept 0.07 + feature contributions = -4.143 (log-odds).
Score = sigmoid(-4.143) = 0.016.

Score0.002
Score22
Run 1

The code mirrors browser API typings, but as hand-written Java it is poorly structured. Public mutable fields are mixed with methods without grouping, and fields like 'prototype' appear after methods, disrupting logical organization. The class has many overloaded addEventListener methods, creating redundancy and clutter; several methods differ only by listener type or capture flag, which could be consolidated or documented. Nesting is flat, which is positive, but clarity of intent suffers because the class lacks documentation and the relationship between fields and methods is not obvious. Action granularity is acceptable (one declaration per line), but reading flow is disorganized—constructors, instance methods, and static fields are interleaved awkwardly. The use of java.util.function.Function<Event,Object> as an event listener type is semantically unclear without context. Overall, the code is readable only if one is already familiar with DOM typings; otherwise, it is dense, repetitive, and missing organizational cues.

Run 2

The code has a flat structure and simple one-action-per-line methods, but readability is significantly reduced by repetitive overloaded methods, long fully-qualified type names, and a lack of comments or organization. The class mixes fields, constructors, and methods without grouping, making intent unclear. Naming like 'oncandidatewindowhide' and 'jsweet.util.StringTypes.MSCandidateWindowHide' adds verbosity. While the code is concise per line, the overall length is inflated by multiple similar overloads. Reading flow is mechanical, resembling auto-generated code rather than human-maintained source.

Run 3

The code is a straightforward domain class with flat structure and minimal nesting, which aids readability. Fields and methods are grouped logically, and each method declaration occupies a single line, aligning with action granularity. However, readability is significantly reduced by several factors: overloaded addEventListener methods create repetition and ambiguity about which variant is intended; the use of long generic types (java.util.function.Function<Event,Object>) clutters the code; and the mix of native, overloaded, and static members lacks clear organization or documentation. The constructor being empty and placed mid-class disrupts reading flow. While the code is concise, its intent is partially obscured by boilerplate-style declarations and lack of comments explaining the purpose of the class or its methods. Overall, it is readable for those familiar with DOM APIs, but not optimized for clarity.

Run 1

Code Structure: Fields and native method declarations are straightforward, but the prototype field and constructor interrupt the event-listener overloads. Nesting: The class is flat, with no nested control flow. Clarity of intent: Descriptive names convey an input-method context API, though abbreviated event-handler names and undocumented native bindings require domain knowledge. Code length: Concise for an API declaration; repeated overloads add visual bulk but serve distinct signatures. Action granularity: Each declaration occupies its own line, making individual members easy to identify. Reading flow: Generally predictable, but long fully qualified types, absent blank-line grouping, and inconsistent placement of related members reduce scanability.

Run 2

Code Structure: A straightforward class declaration, but the prototype field and constructor interrupt the event-listener overloads rather than forming clearly separated sections. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive fields and method names convey an input-method API, although platform-specific types and undocumented native declarations require background knowledge. Code length: Concise for an API binding; repeated overloads and fully qualified types add visual bulk. Action granularity: Each field or method declaration occupies its own line, with no compound operations. Reading flow: Consistent indentation supports readability, but long signatures, absent blank-line grouping, and scattered overload variants reduce the natural flow.

Run 3

Code Structure: Fields and methods are mostly grouped logically, but the prototype field and constructor interrupt the event-listener overloads. Nesting: The class is flat, with no nested control flow. Clarity of intent: Descriptive method names and types clearly suggest an input-method API binding, though undocumented fields and compressed event-handler names reduce clarity. Code length: Concise for a declaration-only class; repeated overloads add visual bulk but serve distinct signatures. Action granularity: Each declaration occupies its own line, making individual members easy to identify. Reading flow: Consistent indentation helps, but missing blank lines, long fully qualified type names, and scattered overload variants make scanning less natural.