Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift4 未声明类型NSLinguisticTagScheme的使用_Swift4_Macos High Sierra_Nslinguistictagger - Fatal编程技术网

Swift4 未声明类型NSLinguisticTagScheme的使用

Swift4 未声明类型NSLinguisticTagScheme的使用,swift4,macos-high-sierra,nslinguistictagger,Swift4,Macos High Sierra,Nslinguistictagger,我让代码在操场上运行,Xcode没有显示任何bug,但是当我在命令行上编译文件时,它返回错误 use of undeclared type NSLinguisticTagScheme and String has no member 'tokenType' 这是问题代码 let tagSchemes : [NSLinguisticTagScheme] = [ .tokenType] let tagger : NSLinguisticTagger = NSLinguisticTagger(tag

我让代码在操场上运行,Xcode没有显示任何bug,但是当我在命令行上编译文件时,它返回错误

use of undeclared type NSLinguisticTagScheme
and String has no member 'tokenType'
这是问题代码

let tagSchemes : [NSLinguisticTagScheme] = [ .tokenType]
let tagger : NSLinguisticTagger = NSLinguisticTagger(tagSchemes: tagSchemes, options: 0)
let options : NSLinguisticTagger.Options = [ .omitPunctuation, .omitWhitespace]

tagger.string = text
let range = NSRange(location: 0, length: text.utf16.count)

tagger.enumerateTags( in: range, unit: .sentence, scheme: .tokenType, options: options, using: 
{ tag, tokenRange, stop in
    let token = (text as NSString).substring(with: tokenRange)
    sentences.append(token)
})

有什么想法吗?

更新Xcode解决了问题

n语言标记方案
从iOS 11开始可用。您是否检查了部署目标?是的,当前正在使用swift 4部署到macOS 10.13,无法在macOS 10.13上复制您的问题您是否能够使用命令行编译该文件?