Skip to content
Swift framework for document classification using a Core ML model.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
DocumentClassifier.xcodeproj Updates for Xcode 10.2 and Swift 5 Apr 20, 2019
NewsClassifier Updates for Xcode 10.2 and Swift 5 Apr 20, 2019
Sources Update to 1.2.0 Apr 20, 2019
Tests Initial example app Dec 24, 2017
.gitignore Initial framework setup Dec 23, 2017
.swift-version Update .swift-version Apr 20, 2019
DocumentClassifier.podspec Update to 1.2.0 Apr 20, 2019
LICENSE Initial commit Dec 23, 2017 Update to 1.2.0 Apr 20, 2019


CocoaPods Version Swift Platform


DocumentClassifier is a Swift framework for classifying documents into one of five categories (Business, Entertainment, Politics, Sports, and Technology). It uses a CoreML model trained with 1,500 news articles from the BBC.


  • iOS 11.0+, macOS 10.13+, tvOS 11.0+, watchOS 4.0+
  • 100% Test Coverage
  • Best CV Score: 0.965333333333


Swift 4 Released (Sample Article)

let text = articleText
guard let classification = classifier.classify(text) else { return }
print(classification.prediction) // Technology: 0.42115752953489294
print(classification.allResults) // Business: 0.141, Entertainment: 0.138, Politics: 0.113, Sports: 0.187, Technology: 0.421



CocoaPods is a centralized dependency manager for Cocoa projects. To install DocumentClassifier with CocoaPods:

  1. Make sure the latest version of CocoaPods is installed.

  2. Add DocumentClassifier to your Podfile:


pod 'DocumentClassifier', '1.2.0'
  1. Run pod install.

Example App

NewsClassifier is an example app using the framework.




Todd Kramer,


You can’t perform that action at this time.