| |
| |
| |
| |
| package parser |
|
|
| import "strings" |
|
|
| |
| type sectionKeyword struct { |
| keyword string |
| section string |
| } |
|
|
| |
| |
| var sectionKeywords = []sectionKeyword{ |
| |
| {"balance sheet", "Balance Sheet"}, |
| {"profit and loss", "Profit and Loss"}, |
| {"profit & loss", "Profit and Loss"}, |
| {"statement of profit", "Profit and Loss"}, |
| {"income statement", "Profit and Loss"}, |
| {"cash flow statement", "Cash Flow Statement"}, |
| {"cash flow", "Cash Flow Statement"}, |
| {"notes to accounts", "Notes to Accounts"}, |
| {"notes to financial", "Notes to Accounts"}, |
| {"significant accounting", "Notes to Accounts"}, |
|
|
| |
| {"management discussion and analysis", "Management Discussion and Analysis"}, |
| {"management discussion", "Management Discussion and Analysis"}, |
| {"md&a", "Management Discussion and Analysis"}, |
| {"director", "Directors Report"}, |
| {"corporate governance", "Corporate Governance"}, |
|
|
| |
| {"auditor", "Auditor Report"}, |
| {"audit report", "Auditor Report"}, |
| {"independent audit", "Auditor Report"}, |
|
|
| |
| {"debt schedule", "Debt Schedule"}, |
| {"borrowing", "Debt Schedule"}, |
| {"long term debt", "Debt Schedule"}, |
|
|
| |
| {"financial highlight", "Financial Highlights"}, |
| {"financial summary", "Financial Highlights"}, |
| {"key financial", "Financial Highlights"}, |
|
|
| |
| {"related party", "Related Party Transactions"}, |
|
|
| |
| {"contingent liab", "Contingent Liabilities"}, |
|
|
| |
| {"covenant", "Covenant Terms"}, |
| {"collateral", "Collateral"}, |
| {"sanction", "Sanction Conditions"}, |
| {"security clause", "Collateral"}, |
|
|
| |
| {"rating rationale", "Rating Rationale"}, |
| {"rating driver", "Key Rating Drivers"}, |
| {"outlook", "Outlook"}, |
|
|
| |
| {"gstr", "GST Filing"}, |
| {"goods and services", "GST Filing"}, |
| } |
|
|
| |
| |
| func DetectSection(pageText string) string { |
| |
| sample := pageText |
| if len(sample) > 500 { |
| sample = sample[:500] |
| } |
| lower := strings.ToLower(sample) |
|
|
| for _, sk := range sectionKeywords { |
| if strings.Contains(lower, sk.keyword) { |
| return sk.section |
| } |
| } |
| return "" |
| } |
|
|