Detect if extracted text is a draft for comments (征求意见稿). Only official/final versions should be included in the knowledge base. Draft documents are identified by explicit markers in the first ~3000 chars.
(text: str)
| 642 | |
| 643 | |
| 644 | def is_draft_content(text: str) -> bool: |
| 645 | """Detect if extracted text is a draft for comments (征求意见稿). |
| 646 | |
| 647 | Only official/final versions should be included in the knowledge base. |
| 648 | Draft documents are identified by explicit markers in the first ~3000 chars. |
| 649 | """ |
| 650 | if not text: |
| 651 | return False |
| 652 | |
| 653 | head = text[:3000] |
| 654 | |
| 655 | draft_patterns = [ |
| 656 | r'征求意见稿', |
| 657 | r'征求\s*意见\s*稿', |
| 658 | ] |
| 659 | |
| 660 | for pat in draft_patterns: |
| 661 | if re.search(pat, head): |
| 662 | return True |
| 663 | |
| 664 | return False |
| 665 | |
| 666 | |
| 667 | def validate_extracted_content( |
no test coverage detected