Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Update to Swift 5 #735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 2012-10-22-nslinguistictagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Computers are a long ways off from "understanding" this question literally, but

```swift
let question = "What is the weather in San Francisco?"
let options: NSLinguisticTaggerOptions = [.OmitWhitespace, .OmitPunctuation, .JoinNames]
let schemes = NSLinguisticTagger.availableTagSchemesForLanguage("en")
let options: NSLinguisticTagger.Options = [.omitWhitespace, .omitPunctuation, .joinNames]
let schemes = NSLinguisticTagger.availableTagSchemes(forLanguage: "en")
let tagger = NSLinguisticTagger(tagSchemes: schemes, options: Int(options.rawValue))
tagger.string = question
tagger.enumerateTagsInRange(NSMakeRange(0, (question as NSString).length), scheme: NSLinguisticTagSchemeNameTypeOrLexicalClass, options: options) { (tag, tokenRange, _, _) in
let token = (question as NSString).substringWithRange(tokenRange)
println("\(token): \(tag)")
tagger.enumerateTags(in: NSMakeRange(0, (question as NSString).length), scheme: .nameTypeOrLexicalClass, options: options) { (tag, tokenRange, _, _) in
let token = (question as NSString).substring(with: tokenRange)
print("\(token): \(tag?.rawValue ?? "no tag")")
}
```
```objc
Expand Down