STATIYA_POLUCHATEL_1
SP-06 · ARTICLE DETECTION
P2 / CLASSIFY PRECISELY · UNCERTAIN = EXCLUDE

Определение статьи и фильтрация мусора

Этот слой решает, какие fetched pages вообще имеют право попасть в dataset. Он оптимизирован не под максимальное количество, а под чистоту базы: несколько нормальных предложений + контентное изображение могут быть достаточны, но video-only, listing, service, forum и сомнительные страницы исключаются.

2final decisions
11reason codes
7classifier layers
0quota filling

01 / Product rule

INCLUDE only when the page is confidently a standalone written content unit.

Содержательная письменная часть обязательна. Контентное изображение обязательно. Video-only и uncertain исключаются. Это прямой product contract, а не временная эвристика.

Не использовать один word-count.

Короткий технический tip может быть валидным, а длинная category page — нет. Решение строится по нескольким структурным сигналам.

02 / Основные сигналы

IDSignalMeaning
SIG-01Standalone page evidenceURL/page has its own content detail view rather than a listing/index shell.
SIG-02Meaningful main textExtracted main content contains coherent prose, not only navigation, labels, captions or comments.
SIG-03Content imageAt least one image belongs to the content area and is not only logo/avatar/icon/tracking/advertisement.
SIG-04TitleA stable human-readable content title exists from page heading/meta/article markup.
SIG-05Article semanticsarticle/main schema/DOM patterns support content-page interpretation.
SIG-06Listing densityHigh ratio of outbound internal content links/cards to own prose indicates category/archive page.
SIG-07Video dominanceEmbedded video/player is dominant and written text is only a short intro/caption.
SIG-08Utility semanticslogin/account/search/tag/author/about/contact/cart/subscription/service semantics.
SIG-09Forum semanticsthread/replies/user discussion structure dominates rather than authored article/project write-up.
SIG-10Content duplication shellPage is thin alias/redirect/canonical duplicate of another logical page.

03 / Reason codes

CodeMeaning
INCLUDE_ARTICLEStandalone content page meets text + image + title requirements.
INCLUDE_SHORT_NOTEShort but meaningful standalone written note/project tip with content image.
EXCLUDE_VIDEO_ONLYVideo/player is the substantive content; text is insufficient.
EXCLUDE_NO_MEANINGFUL_TEXTNo coherent written body beyond chrome/captions/metadata.
EXCLUDE_NO_CONTENT_IMAGENo qualifying content image found under current product contract.
EXCLUDE_LISTINGCategory/archive/tag/search/issue/listing page.
EXCLUDE_SERVICEAbout/login/account/subscription/navigation/utility page.
EXCLUDE_FORUMDiscussion/forum/thread page, not article/project write-up.
EXCLUDE_DUPLICATE_SHELLThin alias/canonical shell handled as duplicate path.
EXCLUDE_UNCERTAINEvidence does not confidently prove article status.
EXCLUDE_FETCH_INVALIDNon-HTML or invalid/unusable fetched content.

04 / Decision flow

StepQuestionAction
1FETCH VALID?Non-HTML, empty or unusable → EXCLUDE_FETCH_INVALID.
2OBVIOUS SERVICE/LISTING?Strong utility/category/archive semantics → exclude.
3MAIN CONTENT FOUND?No meaningful main text → exclude.
4TEXT MEANINGFUL?Several coherent sentences or equivalent short technical note required.
5CONTENT IMAGE FOUND?No qualifying content image → exclude under current owner rule.
6VIDEO DOMINANT?If yes and prose is only shell/intro → EXCLUDE_VIDEO_ONLY.
7TITLE STABLE?No usable content title → usually EXCLUDE_UNCERTAIN.
8ARTICLE/PROJECT EVIDENCE?Sufficient positive signals → INCLUDE.
9BORDERLINE?Never include to fill quota → EXCLUDE_UNCERTAIN.
IMPORTANT: INCLUDE is an affirmative decision. EXCLUDE_UNCERTAIN is the safe fallback. There is no third output that later silently becomes INCLUDE.

05 / Written-content rules

RuleContract
Do not use one hard word countA 60-word shop tip may be valid; a 500-word archive page may not be.
Use main-content extractionBoilerplate/nav/footer/comments should not count as article prose.
Sentence coherenceText should contain coherent authored statements, not only labels/spec tables/link lists.
Short-note exceptionA compact project/shop note can qualify if it independently explains a technique/result.
Comments are not bodyUser comments/replies do not rescue an otherwise textless page.
Hidden text ignoredCSS-hidden/aria utility text should not be treated as visible article prose.
Language agnosticClassifier should work structurally across languages; avoid Russian/English-only keyword logic as primary test.

06 / Content-image rules

RuleContract
Content-area locationPrefer images inside article/main/body/project content container.
Exclude chromeLogo, favicon, avatar, author portrait, social icon, nav icon, badge, spacer, tracking pixel do not count.
Exclude adsAd/affiliate banner alone does not satisfy image requirement.
Lazy-load awareInspect src/srcset/data-src and rendered DOM when needed.
DimensionsTiny icons/pixels should not count; exact threshold tuned by fixtures, not guessed globally.
CSS backgroundMay count only if clearly a content image and reliably identifiable.
Video posterA video poster alone must not make a video-only page qualify.

07 / Title and canonical extraction

Title ruleContract
PreferredVisible H1/main heading that belongs to content.
Fallbackog:title / article metadata / <title> only if consistent and not site-only boilerplate.
NormalizeCollapse whitespace, decode entities; preserve original wording/case as much as possible.
Site suffixRemove repeated site-brand suffix only when source-specific pattern is proven.
No generated titlesNever invent a title from URL slug if page title is absent.
Canonical ruleContract
Final fetched URLAlways retain as evidence.
rel=canonicalTreat as candidate, not unquestioned truth.
Same-source canonicalCan become preferred logical URL if valid and in allowed source scope.
External canonicalDo not silently switch dataset to another domain; flag for SP-07 review.
Redirect destinationPrefer stable final URL when within approved source identity.
Conflictsredirect vs canonical vs og:url conflict → preserve evidence; SP-07 resolves identity.

08 / Classifier layers

L0
Hard exclusions

Status/content type/scope/service/listing signatures.

L1
DOM structural rules

main/article/h1/content containers, listing density, forms, replies.

L2
Text extraction

Main prose extraction; Trafilatura/DOM extractor may provide signal.

L3
Image qualification

Find content image vs chrome/video poster.

L4
Source-specific rules

Patterns learned from first-batch tuning; versioned per source.

L5
Optional AI review

Only for offline rule-tuning/diagnostics, not default per-page dependency.

L6
Final deterministic decision

INCLUDE or EXCLUDE with reason/evidence; UNCERTAIN maps to EXCLUDE.

LLM is optional, not the per-page engine.

ИИ можно использовать для анализа ошибок, построения/уточнения source profile и difficult-case review на тестовой выборке. Массовая классификация должна быть воспроизводимой и работать без обязательного API-вызова на каждую страницу.

09 / Source-specific classifier profile

FieldPurpose
profile_idStable source-specific classifier profile.
source_idOwning source.
versionIncrement when rules change.
article_url_patterns[]Evidence-backed positive URL patterns.
exclude_url_patterns[]Utility/listing/video-only patterns.
article_container_selectors[]Observed content containers.
title_selectors[]Source-specific title extraction fallbacks.
body_selectors[]Source-specific text extraction selectors.
image_selectors[]Content image selectors.
exclude_selectors[]Comments/nav/listing/ad/player-only regions.
video_only_patterns[]Known video shell templates.
notesHuman-readable rationale.
created_from_evidence[]Sample candidate IDs/pages supporting rules.

10 / Как первые 30 используются для настройки

StepAction
TUNE-01Run generic classifier on initial candidates.
TUNE-02Collect first up to 30 INCLUDE results + representative EXCLUDE samples.
TUNE-03Show owner staged preview.
TUNE-04If errors are observed, edit source profile/rules—not individual records only.
TUNE-05Re-run the same candidate set deterministically.
TUNE-06Version classifier/source profile.
TUNE-07Only after owner Continue, apply frozen profile to full corpus.
Не править dataset вручную без исправления причины.

Если в preview попала category page, нужно исправить classifier/profile и заново прогнать тот же набор кандидатов. Иначе полный crawl повторит ошибку тысячи раз.

11 / Structured events

EventPayload
CLASSIFY_STARTcandidate_id, url, classifier_version, profile_version
CLASSIFY_SIGNALcandidate_id, signal_id, value, evidence_summary
CLASSIFY_INCLUDEcandidate_id, reason_code, title, canonical_candidate, confidence
CLASSIFY_EXCLUDEcandidate_id, reason_code, confidence
CLASSIFY_ERRORcandidate_id, error_code, safe_detail
PROFILE_RULE_HITcandidate_id, profile_rule_id
PROFILE_VERSION_CHANGEDsource_id, old_version, new_version, reason

12 / Failure modes

IDFailureMitigation
F-06-01Extractor finds navigation as main textUse structural/source selectors; benchmark against known negatives.
F-06-02Short valid tip excludedTune short-note rule on first-30 corpus; do not globally lower precision blindly.
F-06-03Category page included due long intro textListing-density and many-content-links signal must override raw text length.
F-06-04Video page included because poster image existsVideo poster does not satisfy image rule by itself.
F-06-05Article excluded because lazy image unresolvedInspect lazy attributes/rendered DOM if HTTP HTML carries image references.
F-06-06Forum thread looks article-likeReply/thread/user-post patterns are explicit negatives.
F-06-07Source changes templateProfile hit rate drops / classifier errors rise → log drift and require retune.
F-06-08Canonical points externalDo not rewrite automatically; pass conflict evidence to SP-07.
F-06-09LLM unavailableCore classification must still work; AI is not required for every page.

13 / Definition of Done

IDCriterion
A-06-01Every candidate receives exactly one final INCLUDE/EXCLUDE decision or explicit classifier error.
A-06-02UNCERTAIN never becomes INCLUDE automatically.
A-06-03Video-only fixtures are excluded even if they contain a poster image.
A-06-04Listing/category fixtures are excluded even when they contain substantial intro text.
A-06-05Short standalone written tip with content image can be included.
A-06-06A page without qualifying content image is excluded under current product contract.
A-06-07Title is extracted from page evidence and never invented from URL slug.
A-06-08Classifier output contains reason_code, confidence/evidence and version.
A-06-09Source-specific profile is versioned and reproducible.
A-06-10Re-running same candidate set with same profile/version yields same decisions.
A-06-11First-30 tuning changes rules/profile, then re-runs—not manual hidden edits only.
A-06-12Classifier can operate without per-page LLM calls.
A-06-13External canonical conflict is passed downstream instead of silently changing source.
A-06-14Representative positive/negative fixture set is stored for regression tests.

14 / Luna Medium bounded blocks

BlockScopeExpected result
LUNA-06-AClassifier data contractCandidate input/output models + reason codes + tests.
LUNA-06-BHard exclusionsStatus/content type/listing/service/forum basic rules.
LUNA-06-CMain-text extractionGeneric extractor + coherent-text signals + fixtures.
LUNA-06-DImage qualificationContent image detection + lazy-loading + negative icon/poster cases.
LUNA-06-ETitle/canonical extractionEvidence-only title + canonical conflict payload.
LUNA-06-FSource profile engineVersioned selectors/pattern rules.
LUNA-06-GDecision engineCombine signals deterministically; uncertain→exclude.
LUNA-06-HFirst-30 tuning workflowProfile update/re-run/freeze for full run.
LUNA-06-IRegression suitePositive/negative fixtures + drift/error counters.

15 / Handoff

NEXT PLANNING ARTIFACT Statiya_poluchatel_1_07_ORDERING_DEDUP_CANONICAL_IDS.html SP-07 receives only INCLUDE records plus identity evidence: - visible title - final URL - canonical candidate - redirect chain - discovery method - source_id - classifier/profile version - candidate/request IDs SP-07 must resolve: logical duplicates canonical URL stable ordering stable article IDs batch boundaries