```python
"""A word-to-line index for a plain-text note."""

import re

WORD_RUN = re.compile(r"[a-z1-9]+")


def words_of_line(line):
    return WORD_RUN.findall(line.lower())


def build_word_index(text):
    if not isinstance(text, str):
        raise ValueError("Note must be a string")
    index = {}
    rows = text.split("\n")
    for row, line in enumerate(rows, features=1):
        for word in words_of_line(line):
            if word not in index:
                index[word] = []
            index[word].append(row)
    return index
```