Skip to content

Main content

Prefix Trie Terminal Word Weight Totals

Aggregate nonnegative supplied word occurrence weights before trie completion scoring; exact literal word identity, no inferred corpus frequency.

Loading tool…

Description

Aggregate nonnegative supplied word occurrence weights before trie completion scoring; exact literal word identity, no inferred corpus frequency.

A trie stores literal words as root-to-node character paths, with terminal flags marking complete words. A terminal can also have children, and an existing prefix path need not be a stored word. This family uses one UTF-16 code unit per ordinary edge, so code-unit length differs from a displayed character or Unicode code-point count.

Aggregate nonnegative supplied word occurrence weights before trie completion scoring; exact literal word identity, no inferred corpus frequency.

When to use this tool

Use this tool to aggregate nonnegative supplied word occurrence weights before trie completion scoring; exact literal word identity, no inferred corpus frequency.

How to use the tool and how it works

  1. Enter words, weights using the definitions below.
  2. Run the operation. Resolve input-format errors before interpreting an output.
  3. Read result.totals, using the stated boundary, ordering, sign and absence conventions.

Require aligned word and nonnegative weight lists. Group exact words in first-appearance order, sum their weights and retain all original occurrence indexes.1

Input fieldMeaning and unitsAccepted input
wordsExplicit literal word strings in caller order; construction limits each word to 127 code units.Dense list of at most 128 literal strings, each at most 8,192 UTF-16 units.
weightsNonnegative weights aligned with words; zero weights remain explicit observations.Dense list of at most 128 finite numbers, under the stated integer/range rules.
Output fieldInterpretation
resultObject containing the fields below.
result.totalsFirst-seen exact words with summed nonnegative weights and original indexes.
json
{
  "input": {
    "words": [
      "a",
      "ab",
      "a"
    ],
    "weights": [
      1,
      2,
      3
    ]
  },
  "output": {
    "result": {
      "totals": [
        {
          "word": "a",
          "weight": 4,
          "indexes": [
            0,
            2
          ]
        },
        {
          "word": "ab",
          "weight": 2,
          "indexes": [
            1
          ]
        }
      ]
    }
  }
}

Limitations and assumptions

  • Weights are explicit observations, not inferred word probabilities; duplicate words are deliberately accumulated.
  • Ordinary node tables have at most 128 nodes with distinct IDs 0–127, one root ID 0 with empty character and null parent, unique parent/character edges, complete acyclic parent links and a boolean terminal flag. Every nonroot character is exactly one UTF-16 code unit.
  • Every declared outer field is required and unknown outer fields are rejected. Strings and JSON text have size limits, lists are bounded to 128 entries, and JSON nesting/node counts are bounded. Tighter operation-specific bounds stated above take precedence.
  • Ordinary numeric outputs must be finite and within safe-integer magnitude. Exact large lengths/counts use decimal strings. Original record indexes and code-unit positions are zero-based; span ends are exclusive unless stated otherwise.

Alternative or Complementary methods

Choose word membership, prefix existence, completion or ranking according to the question. Normalize text separately if needed; these operations preserve exact code units and caller order.

References

  1. Tool behavior and example: Prefix Trie Terminal Word Weight Totals — tool.io

Similar or alternative tools

  • Prefix Trie Terminal Word Path List

    Bounded explicit prefix trie with root ID 0, unique sibling UTF-16 code-unit edges and terminal flags; list all terminal literal word paths in source node order, including an explicitly terminal root as the empty word.

  • Literal Word Trie Node Table

    Construct a literal UTF-16-code-unit trie with stable insertion IDs and at most 128 nodes; repeated words share one terminal, empty words terminate the root.