from powerml import FilterTopicsModel


def preprocess_data_into_messages(data):
    data = data.split('\n')
    return [d for d in data if d]


def testFilterTopicsModel():
    topics = [
        'API',
        'VSCode',
        'SourceMark',
        'Auth',
        'Slack',
        'Git',
        'Thread',
        'GitHub',
        'UI',
        'Video',
        'Gradle',
        'Threads',
        'Extension',
        'Dashboard',
        'DB',
        'Hub',
        'Search',
        'Web',
        'Helm',
        'Cache',
        'Styling',
        'PR',
        'Intercom',
        'Deployment',
        'Ingestion',
        'Token',
        'Editor',
        'Logging',
        'CDK',
        'Repo',
        'Sourcemark',
        'Store',
        'Pusher',
        'CI',
        'Login',
        'Notifications',
        'Redis',
        'Chat',
        'Client',
        'IAM',
        'Message',
        'Discussion',
        'S3',
        'OpenAPI',
        'Ktor',
        'ECR',
        'Assets',
        'Config',
        'Refresh',
        'Schema',
        'Webview',
        'Admin',
        'Notification',
        'CloudFront',
        'GraphQL',
        'EKS',
        'JSON',
        'Database',
        'Delete',
        'Onboarding',
        'Download',
        'AWS',
        'ALB',
        'IPC',
        'Ktlint',
        'Build',
        'Secrets',
        'PullRequest',
        'Service',
        'Unread',
        'Filter',
        'URL',
        'Installer',
        'Permissions',
        'Honeycomb',
        'Gutter',
        'Rendering',
        'Sidebar',
        'Upload',
        'Stream',
        'Webpack',
        'SourceMarks',
        'Storybook',
        'SM',
        'Bother',
        'Status',
        'Polling',
        'Commit',
        'Kubernetes',
        'Audio',
        'Mentions',
        'Pull',
        'Cloudfront',
        'Snippet',
        'Adminweb',
        'Path',
        'Point',
        'Email',
        'Transcription',
        'Exceptions',
        'Recording',
        'Icon',
        'Exception',
        'Context',
        'Mark',
        'SCM',
        'Actions',
        'Sort',
        'Screen',
        'Lambda',
        'Repos',
        'Network',
        'Explorer',
        'Person',
        'Team',
        'Logout',
        'Flaky',
        'Authentication',
        'TLC',
        'Merge',
        'User',
        'WAF',
        'UUID',
        'Elasticache',
        'Kotlin',
        'Calico',
        'Timestamp',
        'Migration',
        'ScreenShare',
        'Reactions',
        'Badge',
        'Landing',
        'ThreadStore',
        'Version',
        'Error',
        'Queues',
        'Custom',
        'Button',
        'Headers',
        'Types',
        'Compare',
        'Move',
        'Channels',
        'Screenshare',
        'Retry',
        'Kube',
        'Deployments',
        'Upgrade',
        'DNS',
        'Engine',
        'Release',
        'Grafana',
        'Poller',
        'Turbo',
        'Project',
        'Plugin',
        'Race',
        'Safari',
        'Default',
        'Form',
        'Expose',
        'Badges',
        'Versions',
        'Codegen',
        'Caching',
        'SourcePoints',
        'Deploy',
        'Invite',
        'Job',
        'Take',
        'CPU',
        'Makefile',
        'Proto',
        'Github',
        'EC2',
        'Fixtures',
        'Extractor',
        'Index',
        'Push',
        'RDS',
        'MessageEditor',
        'Transcript',
        'SSL',
        'Agent',
        'Resolution',
        'Probes',
        'Refactor',
        'Install',
        'Resiliency',
        'Walkthrough',
        'Rename',
        'Enable',
        'Contributors',
        'Swift',
        'Teams',
        'Lookup',
        'Images',
        'TreeView',
        'Postgres',
        'Webhook',
        'Upsert',
        'Sourcemarks',
        'Topics',
        'Unblocked',
        'Tests',
        'Tabs',
        'DAO',
        'Debug',
        'Stop',
        'PRs',
        'Insight',
        'Agora',
        'Model',
        'Update',
        'Tokens',
        'Bug',
        'Twilio',
        'Identity',
        'Title',
        'Shiki',
        'KMS',
        'AuthStore',
        'Webhooks',
        'GRPC',
        'Models',
        'Recommendation',
        'Deduplication',
        'Command',
        'Logic',
        'Org',
        'Tooltip',
        'Serialization',
        'Transaction',
        'XForwardedHeaderSupport',
        'Sharing',
        'Input',
        'Health',
        'NPM',
        'Logger',
        'Set',
        'Data',
        'Accessibility',
        'Installation',
        'Builder',
        'File',
        'Metrics',
        'Clients',
        'Query',
        'Overlay',
        'References',
        'Bastion',
        'Heap',
        'Node',
        'Ansible',
        'SSH',
        'Rename: GitHub',
        'Error: Handling',
        'Recording: File',
        'Cache: ThreadInfos',
        'Safari: Archive',
        'Compare: Versions',
        'Refactor: Mocked',
        'Thread: Queries',
        'Drop: Columns',
        'Onboarding: Fill',
        'Move: Utils',
        'Fix: DiffStatParser',
        'Add: Insights',
        'Status: Bar',
        'Basic: Video',
        'Update: Forms',
        'Asking: Question',
        'InstallationsAPI: Setting',
        'Add: Version',
        'Editor: Console',
        'ThreadModel',
        'IP',
        'Flex',
        'Grid',
        'Chrome',
        'Sourcemap',
        'Syncing',
        'Components',
        'GradleCache',
        'Optional-Chaining',
        'Interfaces',
        'Muxer',
        'Recalculate',
        'Filtering',
        'Refactoring',
        'Queueing',
        'Indexing',
        'Normalizing',
        'Deleting',
        'Paddings',
        'Showing',
        '2Redirect',
        '3Index',
        '4Recalculation',
        '5Linter',
        '6Wizard',
        '7Login',
        '8Styling',
        '9CI/CD',
        '10Ingest',
        '11Spinner',
        '12Chat',
        '13CloudFront',
        '14Indexing',
        '15Asset',
        '16Slack',
        '17AWS',
        '18WAF',
        'Template',
        'Anti-affinity',
        'OpenTelemetry',
        'Scoped',
        'Godmode',
        'Static',
        'Matrix',
        'Bandaid',
        'Tweak',
        'Diff',
        'Ownership',
        'Archive',
        'Pinning',
        'App',
        'Socket',
        'Feature',
        'RABC',
        'ComputeStack',
        'Statuses',
        'Header',
        'Modal',
        'Colors',
        'Enum',
        'ThreadRank',
        'Sourcepoint',
        'Invitation',
        'Fuzzy',
        'Optional',
        'SearchModel',
        'Resources',
        'DAU',
        'Endpoints',
        'Validation',
        'Code',
        'Flow',
        'Knowledge',
        'Markdown',
        'Spacing',
        'HLS',
        'REST',
        'Editing',
        'Pagination',
        'Columns',
        'Fetch',
        'Optimize',
        'Performance',
        'Getstream',
        'Net',
        'Pod',
        'Create',
        'Compress',
        'Paging',
        'Querying',
        'Streams',
        'Persistence',
        'Stitching',
        'Redirects',
        'Sanitizing',
        'Uploads',
        'Renaming',
        'UUIDs',
        'Splitting',
        'Sentry',
        'Promises',
        'Configs',
        'Messages',
        'JDBC',
        'Checkbox',
        'Theming',
        'Wait-For-Auth',
        'Tutorial',
        'Amazon',
        'Promise',
        'Preference',
        'Sheet',
        'Endpoint',
        'Vault',
        'Put',
        'Generator',
        'Comments',
        'Worker',
        'Node-fetch',
        'HTML',
        'Rust',
        'Failsafe',
        'Assertion',
        'ThreadInfo',
        'Installs',
        'Wizard',
        'Peering',
        'Permission',
        'Alert',
        'Digest',
        'Calculator',
        'Static Site',
        'VPN',
        'Dev',
        'CI/CD',
        'Tree',
        'Linter',
        'Panel',
        'BasicAuth',
        'Utility',
        'Identifier',
        'gRPC',
        'Color',
        'TeamMembers',
        'Breakpoint',
        'Building',
        'Batch',
        'Errors',
        'Funnel',
        'Connect',
        'Sequence',
        'Utilities',
        'Changes',
        'Blame',
        'Flag',
        'Wildcard',
        'Gate',
        'Progress',
        'Embed',
        'Paginate',
        'Codeblocks',
        'RSS',
        'Regression',
        'Signal',
        'Ktors',
        'Slate',
        'TreeCache',
        'GH',
        'Zustand',
        'Docker',
        'gzip',
        'Highlighting',
        'GH Install',
        'Web Extension',
        'Parsing',
        'Triggering',
        'Annotation',
        'Signatures',
        '<tr>',
        'Favicons',
        'Junit5',
        'Protos',
        'FIFO',
        'AssemblyAI',
        'Logz',
        'Tracks',
        'Trace',
        'Cursor',
        'Notes',
        'CORS',
        'Documentation',
        'Provider',
        'Graph',
        'getRelatedTopics - Operation',
        'Thread - Participant',
        'Toggle - Sidebar',
        'Bastion - Host',
        'Reset - Menu',
        'Cdk - IAM',
        'Delay - Rate',
        'Login - Dialog',
        'Hide - Scrollbars',
        'Port - SMA',
        'Fix - Cache',
        'Thread - Multiple',
        'Breaks - API',
        'Move - Files',
        'Change - RDS',
        'Add - Treeview',
        'Scm - Webhook',
        'Use - Pre-loaded',
        'Trigger',
        'Anchor',
        'Settings',
        'Buffer',
        'LazyVStack',
        'FuzzyCompare',
        'Reader',
        'Spin',
        'Align',
        'PullRequests',
        'Switch',
        'Copy',
        'Add',
        'Simplify',
        'Implement',
        'Routes',
        'Connection',
        'Pooling',
        'Isolation',
        'Points',
        'Unreads',
        'Baselines',
        'Organization',
        'Deserialization',
        'MajorPageFault',
        'OpenVPN',
        'Initialization',
        'FileContentHash',
        'OpenJDK',
        'Transcriptions',
        'Rawgit',
        'Characterization',
        'Scrolling',
        'Duplication',
        'Planning',
        'Execution',
        'Searching',
        'Off-by-one',
        'Pid',
        'Interrupted',
        'Baseurl',
        'Submodule',
        'Content',
        'VCS',
        'Router',
        'Background',
        'NSCache',
        'Popover',
        'Packager',
        'Onigiri',
        'WebRTC',
        'PixelBufferPool',
        'HMAC',
        'DatabaseId',
        'Telemetry',
        'Sourcepoints',
        'Social',
        'CodeAction',
        'Pipeline',
        'Wrapper',
        'Keep-Alive',
        'Insiders',
        'Factory',
        'Translator',
        'Discussions/Notes: Component',
        'Chat: Layout',
        'Honeycomb: Record',
        'VSCode: Codeblock',
        'StartDiscussion',
        'App: Alert',
        'Permalink: Hash',
        'Web: Extension',
        'Scroll',
        'Gutter: Icons',
        'Smoke: Tests',
        'Team: Members',
        'VSCode: Directory',
        'Env: Secrets',
        'Initial: Onboarding',
        'DataCacheStore',
        'Queue',
        'Insights',
        'Detekt',
        'Textarea',
        'Intersection',
        'Protobuf',
        'Signing',
        'Reflection',
        'Secret',
        'Host',
        'Retries',
        'Scaling',
        'Navigation',
        'Diffing',
        'Localstack',
        'Transcribe',
        'Screenshots',
        'Hook',
        'Asset',
        'Infra',
        'OpenAI',
        'Mixins',
        '10Ktlint',
        '11Walkthrough',
        '12VideoBlock',
        '13MessageContent',
        '14CreateThreadRequest',
        '15Image',
        '16Anchor',
        '17CreateMessageRequest',
        '18Sourcemarks',
        '19TeamMembers',
        'Gzip',
        'UX',
        'store',
        'test',
        'events',
        '401',
        'route',
        'openapi',
        'identity',
        'lambda',
        'thread',
        'tree',
        'webhook',
        'logging',
        'org',
        'CName',
        'DnsStack',
        'AcmStack',
        'Cookie',
        'QOL',
        'Resizer',
        'Cursors',
        'Singleton',
        'Sandboxed',
        'Dedupe',
        'Scheduler',
        'Logs',
        'WebviewPanelProxy',
        'RepoStore',
        'LEFT',
        'DateTime',
        'Mobile',
        'Terms',
        'AppKit',
        'Invites',
        'Instances',
        'Soft-delete',
        'Report',
        'Decay',
        'Deepcheck',
        'LoginOptions',
        'Workflows',
        'Ingest',
        'Native',
        'Deserializers',
        'Lock',
        'Split',
        'Carousel',
        'Tooltips',
        'LatestSourcePointReq',
        'SlackChannelPreferencesModel',
        'TextEditor',
        'Python',
        'ReferencePanel',
        'AtMentionFramework',
        'X-Request-ID',
        'InviteFlow',
        'EFS',
        'GutterIcon',
        'ReactRouter',
        'SourceMarkScheduler',
        'CoroutineScope',
        'MessageModel',
        'Lucene',
        'Redirect',
        'Traffic',
        'Send',
        'Recalculation',
        'Props',
        'Services',
        'Runner',
        'Videometadata',
        'Configuration',
        'Transactions',
        'Observer',
        'Events',
        'Focus',
        'Breaks: API',
        'Fix: Bugs',
        'Issues',
        'Use: Fat',
        'Render: Comment',
        'Strip: Signature',
        'Refactor: Wizard',
        'Threads: Query',
        'Participant',
        'Tab: Message',
        'Deploy: Dev',
        'Prod',
        'SecOps',
        'Fix: Theme',
        'Border',
        'Add: Support',
        'Serializer',
        'Vector',
        'Finish: Indexing',
        'Processing',
        'SearchEventPayload',
        'Workflow',
        'Branch',
        'SQS',
        'SourcePoint',
        'Bucket',
        'Releases',
        'Layout',
        'Inline',
        'Replication',
        'Core',
        'Hashing',
        'asynchronous',
        'timers',
        'Jest',
        'repo',
        'recommended',
        'git',
        'utils',
        'runners',
        'disabled',
        'mic',
        'camera',
        'Proxyman',
        'badge',
        'Package',
        'Scope',
        'elasticache',
        'Master',
        'TeamMember',
        'TextEditorSourceMark',
        'SidebarWebviewProvider',
        'Optional-chain',
        'Column',
        'Benchmark',
        'Lemmatize',
        'Recalculator',
        'MessageDAO',
        'Rename: isDeactivated',
        'OpenAPI: Generator',
        'BERT: Training',
        'Boundary: Move',
        'API: Ingestion',
        'Button: Component',
        'Permission: Producer',
        'Indentation: Editor',
        'Deployment: Triggers',
        'Theming: Prototype',
        'Validate: SHA',
        'Drag: Drop',
        'Disable: Health-check',
        'Library: Components',
        'Extension: Spinners',
        'Request: CPU',
        'Polling: Unnecessary',
        'Video: Channel',
        'localstack',
        'Make',
        'AWSProvider',
        'Cdk',
        'zally',
        'metrics',
        'cdk',
        'DialogHeader',
        'redis',
        'ModelBuilders',
        'SourcePointModel',
        'hub',
        'telemetry',
        'Levenshtein',
        'extensionbuilds',
        'point',
        'mongo',
        'libraries',
        'junit',
        'UnblockedPRCommentMessagePayload',
        'APIs',
        'Function',
        'Non-optional',
        'Build-config',
        'Helper',
        'Persist',
        'Tweaks',
        'Overrides',
        'Calculation',
        'Touch',
        'Backfill',
        'Installations',
        'Marked',
        'Participants',
        'Throttling',
        'Transport',
        'Options',
        'LogzIO',
        'Revert',
        'Active',
        'Locks',
        'DEV',
        'Results',
        'JS',
        'Read-only',
        'Role',
        'Fallback',
        'Popup',
        'Warning',
        'XcodeCloud',
        'KnowledgeForm',
        'Shared',
        'Ordering',
        'Author',
        'Join',
        'ChannelPoller',
        'Bulk',
        'TabView',
        'Protocol',
        'SwiftUI',
        'Links',
        'Plumbing',
        'Interop',
        'Enums',
        'Properties',
        'Wording',
        'Resting',
        'Paths',
        'Calc',
        'Finder',
        'SourceMark: Limit',
        'Principal: Application',
        'Call',
        'Unreads: Badge',
        'Channel',
        'CloudFront: CDK',
        'Fifo',
        'Edge',
        'Screen: Picker',
        'VS Code',
        'Assets: CORS',
        'Creation',
        'Time: Admin',
        'Debugging',
        'GitHub: Messages',
        'Unencrypted',
        'Java: Runner',
        'Arguments',
        'ZGC',
        'Login: Dev',
        'Localhost',
        'Tree: Views',
        'Stores',
        'SourceMark: Commits',
        'Untracked',
        'VSCode: Tree',
        'Compute: Stack',
        'Future: HTTP',
        'Response',
        'Web: Deploy',
        'Variables',
        'Remove - CodeBlock',
        'Highlight - VSCode',
        'Poll - Token',
        'Fix - UI',
        'Set - ThreadUnreadModel',
        'Create - Instant',
        'Deploy - Agora',
        'Fix - Dependency',
        'Point - Services',
        'Do - Model',
        'Add - Tree',
        'Add - Links',
        'Optimize - SM',
        'Use - Last',
        'Add - Secrets',
        'Land - Action',
        'Add - Avatars',
        'Move - Shared',
        'GitHub - App',
        'Add - Tailwind',
        'HWM',
        'Pre-auth',
        'Typos',
        'Plug-in',
        'Rebuilding',
        'VSCodium',
        'Counting',
        'Blob',
        'Streaming',
        'Sandbox',
        'Console',
        'UnsavedChangeTracker',
        'Mac',
        'K6',
        'UnreadStore',
        'MessageMentionModels',
        'CustomGitProvider',
        'ASM',
        'STS',
        'Chromatic',
        'DataAPIStream',
        'APIStream',
        'Screensharing',
        'Hover',
        'Files',
        'Calculations',
        'Fonts',
        'Cloudformation',
        'React',
        'Matt',
        'Orgs',
        'Log',
        'Thundra',
        'Zally',
        'Slatejs',
        'Hooks',
        'Logzio',
        'ID']
    model = FilterTopicsModel()
    model.fit(topics, topic_type="technical system-level topics")
    filtered_topics = model.predict()
    assert len(filtered_topics) > 0


if __name__ == "__main__":
    testFilterTopicsModel()
