Skip to content
Searches page titles, headings, and route paths. Press slash to focus.

Risk-factor changes

Result: the script below compares Item 1A, Risk Factors, in a company's last two 10-Ks (annual reports). It counts the sentences that are the same, edited, added, and removed, and lists those on one topic. For the Apple Inc. 10-Ks filed October 31, 2025 and November 3, 2026, it printed:

Text
2025-10-31 -> 2026-11-03
304 sentences before, 378 now
163 same, 78 edited, 137 added, 63 removed
App Store: 0 edited, 2 added, 1 removed
+ The Company distributes third-party applications through the App Store.
+ For example, in the U.S., the Company has implemented changes to how
  developers communicate with consumers within applications on the U.S.
  storefront of the iOS and iPadOS App Store regarding alternative purchasing
  mechanisms.
- For example, in the U.S., the Company has implemented changes to how
  developers communicate with consumers within apps on the U.S. storefront of
  the iOS and iPadOS App Store regarding alternative purchasing mechanisms and
  is currently subject to a court order preventing it from imposing any
  commission or fee on certain purchases that consumers make.

The topic lines mark each sentence ~ for edited (its new wording), + for added, and - for removed. The second + line and the - line share about 70% of their words, under SIMILAR (80%), so they count as added and removed.

The script

Run it:

  • Save the script as risks.py beside helper.py, and run python risks.py.
  • It makes 3 requests, and 1 more for each extra page of a long Item 1A. Runs on the Free plan (limits).

First call: step 1 of the script as a curl command, with your key in the Authorization: Bearer header. It returned:

Shell
curl -sS -G -H "Authorization: Bearer $SECBLAST_API_KEY" \
  'https://api.secblast.com/v3/sections' \
  -d 'section=10k.1a' \
  -d 'amendments=exclude' \
  -d 'ticker=AAPL' \
  -d 'limit=2'
JSON
{
  "data": [
    {
      "filing": {
        "accession": "0000320193-26-000026",
        "filing_date": "2026-11-03",
        "primary_name": "Apple Inc."
      }
    },
    {
      "filing": {
        "accession": "0000320193-25-000079",
        "filing_date": "2025-10-31",
        "primary_name": "Apple Inc."
      }
    }
  ]
}
Python
import re
import textwrap
from collections import Counter
from difflib import SequenceMatcher

from helper import get  # helper.py: www.secblast.com/docs/workflows

TICKER = "AAPL"  # the company
TOPIC = "App Store"  # the topic whose sentences are listed, in any letter case
SIMILAR = 0.8  # how alike a changed sentence must be to count as edited
# A sentence ends at ".", "!", or "?" followed by a space and a capital,
# but not after an abbreviation such as "U.S.", "Inc.", or "No.".
SENTENCE_END = re.compile(r"(?<=[.!?])\s+(?=[A-Z“])")
ABBREVIATION = re.compile(
    r"(\b[A-Z]\.[A-Z]\.|\b(Inc|Corp|Co|Ltd|No|Mr|Ms|Dr|St)\.)$"
)


def split(line):
    out = []
    for piece in SENTENCE_END.split(line):
        if out and ABBREVIATION.search(out[-1]):
            out[-1] += " " + piece  # the piece before ends in an abbreviation
        else:
            out.append(piece)
    return out


def sentences(accession):
    """Item 1A's sentences of 40 characters or more, read page by page."""
    text, offset = "", None
    while True:
        page = get(
            f"/v3/filings/{accession}/sections/10k.1a/text", offset=offset
        ).json()
        text += page["text"]
        if not page["text_truncated"]:
            break
        offset = page["next_offset"]
    out = []
    for line in text.splitlines():
        out += split(" ".join(line.split()))
    return [s for s in out if len(s) >= 40]  # drops headings and page labels


def similarity(a, b):
    """0 to 1: the share of the two sentences' words that match in order."""
    return SequenceMatcher(None, a.split(), b.split(), autojunk=False).ratio()


# 1. Find the company's two newest 10-Ks with Item 1A, amendments left out.
filings = get(
    "/v3/sections",
    section="10k.1a",
    ticker=TICKER,
    amendments="exclude",
    limit=2,
).json()["data"]
if len(filings) < 2:
    raise SystemExit(f"{TICKER} has fewer than two 10-Ks with Item 1A.")
older, newer = sorted(
    (f["filing"] for f in filings), key=lambda f: f["filing_date"]
)

# 2. Read Item 1A of both.
now = sentences(newer["accession"])
before = sentences(older["accession"])

# 3. Compare the sentences. A new sentence at least SIMILAR to an old one is
# that sentence edited, not added and removed.
now_count, before_count = Counter(now), Counter(before)
same = sum((now_count & before_count).values())
added = list((now_count - before_count).elements())
removed = list((before_count - now_count).elements())
edited = []  # (old, new) pairs
for sentence in list(added):
    best = max(removed, key=lambda r: similarity(sentence, r), default=None)
    if best is not None and similarity(sentence, best) >= SIMILAR:
        added.remove(sentence)
        removed.remove(best)
        edited.append((best, sentence))
print(older["filing_date"], "->", newer["filing_date"])
print(len(before), "sentences before,", len(now), "now")
print(same, "same,", len(edited), "edited,", len(added), "added,",
      len(removed), "removed")
on_topic = [
    (mark, s)
    for mark, found in (
        ("~", [new for old, new in edited]), ("+", added), ("-", removed)
    )
    for s in found
    if TOPIC.lower() in s.lower()
]
counts = Counter(mark for mark, _ in on_topic)
print(f"{TOPIC}: {counts['~']} edited, {counts['+']} added,",
      f"{counts['-']} removed")
for mark, s in on_topic:
    print(mark, "\n  ".join(textwrap.wrap(s, 76)))

What each step returns

1. Find the two 10-Ks. The sections route lists the filings that have one section, newest first. 10k.1a is Item 1A of a 10-K; SEC terms lists other section keys. amendments=exclude leaves out amended 10-Ks (10-K/A), and limit=2 keeps the two newest. The first call above shows its answer.

2. Read Item 1A. The text route returns the section as plain text in text. A long section comes in pages: text_truncated is true when more text follows, and the script asks again from next_offset. Apple's Item 1A fits on one page. It returned (the start shown):

JSON
{
  "accession": "0000320193-26-000026",
  "section": "10k.1a",
  "text_total_bytes": 87143,
  "text_truncated": false,
  "text": "Item 1A. Risk Factors\nThe following summarizes factors that could have a material adverse effect on the Company’s business, reputation, results of operations, financial condition and stock price. …"
}

3. Compare the sentences. The script splits each Item 1A into sentences, and leaves out pieces under 40 characters, such as headings and page labels. Then it sorts the sentences:

  • Same: in both 10-Ks.
  • Edited: a new sentence at least SIMILAR alike an old one, by the share of their words that match in order.
  • Added or removed: the rest.

Going further

  • Looser matching: a lower SIMILAR counts more changed sentences as edited, such as the + and - pair above.
  • Pairing order: each new sentence, in order, takes the most alike old sentence still unpaired. Another order can pair a few sentences differently.

Next: Filings