Description
Type/token ratio in one explicitly bounded transcript window.
Speech and language research can use periods, samples, utterances, phoneme tokens, transcript labels, and timed observations. Counts and durations give different denominators, while missing or unscorable records need an explicit policy. Arithmetic on these annotations does not itself establish a validated clinical measure.
Type/token ratio in one explicitly bounded transcript window.
When to use this tool
Use Language Sample Type Ratio Fixed Window when you need the stated acoustic, annotation, timing, or record-support calculation for supplied research data.
How to use the tool and how it works
- Enter tokens, start, window, caseSensitive. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read tokenCount, typeCount, ratio. Use the output convention below.
Take exactly window tokens from zero-based start, optionally lowercase them, and return typeCount divided by tokenCount. Require a positive window at most 256 fitting inside the list.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| tokens | Tokens | Required. Array of text; maximum UTF-16 length 8192; maximum items 256. |
| start | Start | Required. Safe integer; minimum 0. |
| window | Window | Required. Safe integer; minimum 1; maximum 256. |
| caseSensitive | Case Sensitive | Required. Boolean. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| tokenCount | Token Count | Required. Safe integer. |
| typeCount | Type Count | Required. Safe integer. |
| ratio | Ratio under the stated units and direction. | Required. Finite number. |
{
"input": {
"tokens": [
"A",
"a",
"b",
"c"
],
"start": 0,
"window": 3,
"caseSensitive": false
},
"output": {
"tokenCount": 3,
"typeCount": 2,
"ratio": 0.6666666666666666
}
} Limitations and assumptions
- Case conversion uses JavaScript lowercase, not full Unicode case folding. Tokenization, morphology, language norms, and a clinical interpretation of lexical diversity are not provided.
- The field tables state structural bounds; the mechanics also specify cross-field constraints. Malformed inputs and unsupported domains cause errors. A successful false flag, empty branch value, or zero placeholder has the meaning stated above and is distinct from an input error.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Signed zero is exported as zero.
Alternative or Complementary methods
Use validated acoustic extraction and annotation procedures for the intended research task. A clinical interpretation needs an appropriate assessment method beyond this supplied-data calculation.
References
Similar or alternative tools
- Language Sample Mean Utterance Term
Mean caller-defined units per explicitly eligible utterance.
- Phoneme Window Reference Gap
Return observed-minus-reference onset and offset gaps and divide the duration difference by positive samplePeriod for durationGapInSamples.