<commit_before>import UIKit
import WMF

@objc(WMFDisambiguationPagesViewController)
class DisambiguationPagesViewController: ArticleFetchedResultsViewController {
    
    let siteURL: URL
    let articleURLs: [URL]
    @objc var resultLimit: Int = 10
    
    @objc(initWithURLs:siteURL:dataStore:theme:)
    required init(with URLs: [URL], siteURL: URL, dataStore: MWKDataStore, theme: Theme) {
        self.siteURL = siteURL
        self.articleURLs = URLs
        super.init()
        self.dataStore = dataStore
        self.theme = theme
        self.title = WMFLocalizedString("page-similar-titles", value: "Similar pages", comment: "Label for button that shows a list of similar titles (disambiguation) for the current page")
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func setupFetchedResultsController(with dataStore: MWKDataStore) {
        let request = WMFArticle.fetchRequest()
        request.predicate = NSPredicate(format: "key IN %@", articleURLs.compactMap { $0.wmf_articleDatabaseKey })
        request.sortDescriptors = [NSSortDescriptor(key: "key", ascending: true)]
        fetchedResultsController = NSFetchedResultsController(fetchRequest: request, managedObjectContext: dataStore.viewContext, sectionNameKeyPath: nil, cacheName: nil)
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        fetch()
    }
    
    lazy var fakeProgressController: FakeProgressController = {
        return FakeProgressController(progress: navigationBar, delegate: navigationBar)
    }()
    
    func fetch() {
        fakeProgressController.start()
        self.dataStore.articleSummaryController.updateOrCreateArticleSummariesForArticles(withURLs: articleURLs) { (_, error) in
            self.fakeProgressController.finish()
            if let error = error {
                self.wmf_showAlertWithError(error as NSError)
                return
            }
        }
    }
    
    override var eventLoggingLabel: EventLoggingLabel? {
        return .similarPage
    }
    
    override var eventLoggingCategory: EventLoggingCategory {
        return .article
    }<commit_msg>match prior appearance of disambiguation pages view<commit_after>import UIKit
import WMF

@objc(WMFDisambiguationPagesViewController)
class DisambiguationPagesViewController: ArticleFetchedResultsViewController {
    
    let siteURL: URL
    let articleURLs: [URL]
    @objc var resultLimit: Int = 10
    
    @objc(initWithURLs:siteURL:dataStore:theme:)
    required init(with URLs: [URL], siteURL: URL, dataStore: MWKDataStore, theme: Theme) {
        self.siteURL = siteURL
        self.articleURLs = URLs
        super.init()
        self.dataStore = dataStore
        self.theme = theme
        self.title = WMFLocalizedString("page-similar-titles", value: "Similar pages", comment: "Label for button that shows a list of similar titles (disambiguation) for the current page")
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func setupFetchedResultsController(with dataStore: MWKDataStore) {
        let request = WMFArticle.fetchRequest()
        request.predicate = NSPredicate(format: "key IN %@", articleURLs.compactMap { $0.wmf_articleDatabaseKey })
        request.sortDescriptors = [NSSortDescriptor(key: "key", ascending: true)]
        fetchedResultsController = NSFetchedResultsController(fetchRequest: request, managedObjectContext: dataStore.viewContext, sectionNameKeyPath: nil, cacheName: nil)
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        fetch()
    }
    
    lazy var fakeProgressController: FakeProgressController = {
        return FakeProgressController(progress: navigationBar, delegate: navigationBar)
    }()
    
    func fetch() {
        fakeProgressController.start()
        self.dataStore.articleSummaryController.updateOrCreateArticleSummariesForArticles(withURLs: articleURLs) { (_, error) in
            self.fakeProgressController.finish()
            if let error = error {
                self.wmf_showAlertWithError(error as NSError)
                return
            }
        }
    }
    
    override func configure(cell: ArticleRightAlignedImageCollectionViewCell, forItemAt indexPath: IndexPath, layoutOnly: Bool) {
        super.configure(cell: cell, forItemAt: indexPath, layoutOnly: layoutOnly)
        cell.topSeparator.isHidden = indexPath.item != 0
        cell.bottomSeparator.isHidden = false
    }
    
    override var eventLoggingLabel: EventLoggingLabel? {
        return .similarPage
    }
    
    override var eventLoggingCategory: EventLoggingCategory {
        return .article
    }
{'fraction_non_alphanumeric': 0.08016528925619834, 'fraction_numerical': 0.001446280991735537, 'mean_word_length': 3.169681309216193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5040225', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1315, 'n_words': 308}