Sample

Schnappinger/jsweet/def.dom.NodeSelector

Human rating uses the original dataset scale.

Human3.95
Lines7

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.0990–1; higher is more readable
74.2Δ 4.8
Scalabrino0.490–1; higher is more readable
8.9Δ 60.6
Dorn0.590–1; higher is more readable
67.0Δ 2.5
Mi0.2770–1; higher is more readable
18.8Δ 50.7
LLOC2Logical lines; fewer is more readable
94.6Δ 25.1
DeepSeek V4 Pro16.330–20; mean of three runs
53.1Δ 16.3
GPT-6.1 Sol190–20; mean of three runs
92.6Δ 23.1
BTTF0.5720–1; higher is more readable
53.1Δ 16.3
Human3.951–4; original rating
69.5

Views

Source code

package def.dom; @jsweet.lang.Interface public abstract class NodeSelector extends def.js.Object { native public Element querySelector(String selectors); native public NodeListOf<Element> querySelectorAll(String selectors); }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
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.707−7.061
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.206.716−6.822
Source linesThe number of non-empty source lines.7+2.8

Intercept 8.87 + feature contributions = -2.213 (log-odds).
Score = sigmoid(-2.213) = 0.099.

Score0.49

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.8+0.753
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.73+0.573
Indentation frequencyHow rapidly indentation changes from line to line.6−0.53
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.6.878−0.314
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.075+0.217

Intercept 0.07 + feature contributions = 0.364 (log-odds).
Score = sigmoid(0.364) = 0.59.

Score0.277
Score2
Run 1

The code is a clean, concise TypeScript declaration file for a DOM interface. It has a clear package structure, minimal nesting, and each method is declared on its own line, which enhances readability. The class is abstract and annotated appropriately with 'jsweet.lang.Interface', indicating its purpose. The naming conventions are consistent and descriptive. The absence of implementation details keeps the code short and focused. The only minor drawbacks are the lack of documentation comments and the single blank line at the end, which slightly reduce clarity but do not significantly impact readability.

Run 2

The code is highly readable due to its concise structure and clear intent. It defines an interface with two method signatures, each on a single line, and uses native declarations to indicate external implementation. Nesting is minimal, action granularity is appropriate, and the reading flow is natural. The score is slightly reduced because the package and annotation context are not self-explanatory without familiarity with jsweet, but overall the code is clean and understandable.

Run 3

The code is highly readable due to its simplicity and clarity. It defines an interface with two native methods, each on a single line, making the intent obvious. The structure is logical, with a clear package and annotation. Nesting is minimal, and the reading flow is natural. However, the score is slightly reduced because it lacks documentation or comments explaining the purpose or usage, and the class-level annotations could benefit from a brief explanation. Overall, it is concise, well-organized, and easy to understand for developers familiar with Java and DOM APIs.

Run 1

Code Structure: The package, annotation, class, and two related method declarations are logically organized. Nesting: Only a single class scope, with no nested control flow. Clarity of intent: NodeSelector and its query methods clearly communicate DOM selection functionality, supported by descriptive parameter and return types. Code length: Minimal and appropriate for an interface-like declaration. Action granularity: Each method declaration occupies its own line. Reading flow: Natural top-to-bottom progression; a blank line after the package declaration and conventional public native modifier ordering would slightly improve presentation.

Run 2

Code Structure: The package, annotation, class, and method declarations are logically organized. Nesting: Only one class level, with no nested control flow. Clarity of intent: NodeSelector, querySelector, querySelectorAll, and their return types clearly communicate DOM selection functionality. Code length: Minimal and concise, with no unnecessary code. Action granularity: Each declaration occupies its own line. Reading flow: Natural top-to-bottom progression; a blank line after the package and the conventional modifier order 'public native' would slightly improve presentation.

Run 3

Code Structure: The package, annotation, class declaration, and methods are logically organized. Nesting: Only a single class scope is present, making the code easy to scan. Clarity of intent: NodeSelector and its clearly named querySelector and querySelectorAll methods communicate their purposes, with explicit parameter and return types. Code length: The declaration is concise and contains no unnecessary logic. Action granularity: Each method declaration occupies its own line. Reading flow: The code follows a natural top-to-bottom order. Minor readability improvements include a blank line after the package declaration and conventional public native modifier ordering.