Device vs. Simulator Linguistic Schemes

时光总嘲笑我的痴心妄想 提交于 2019-12-18 06:20:51

问题


Does anyone understand why this is happening?

On any simulator all of the schemes are found with the following code:

NSArray<NSLinguisticTagScheme> *availSchemes = [NSLinguisticTagger availableTagSchemesForLanguage:@"en"];
for (NSLinguisticTagScheme scheme in availSchemes) {
    NSLog(@"Tag scheme %@", scheme);
}

yielding the following:

2018-02-13 09:12:54.066970-0500 MY_APP[79671:5737063] Tag scheme Language
2018-02-13 09:12:54.067160-0500 MY_APP[79671:5737063] Tag scheme Script
2018-02-13 09:12:54.067300-0500 MY_APP[79671:5737063] Tag scheme TokenType
2018-02-13 09:12:54.067425-0500 MY_APP[79671:5737063] Tag scheme LexicalClass
2018-02-13 09:12:54.067541-0500 MY_APP[79671:5737063] Tag scheme NameType
2018-02-13 09:12:54.067655-0500 MY_APP[79671:5737063] Tag scheme NameTypeOrLexicalClass
2018-02-13 09:12:54.067768-0500 MY_APP[79671:5737063] Tag scheme Lemma

However, on my device (iPhone 6s iOS 11.2) I receive the following..

2018-02-13 09:13:09.834879-0500 MY_APP[4327:313598] Tag scheme Language
2018-02-13 09:13:09.835256-0500 MY_APP[4327:313598] Tag scheme Script
2018-02-13 09:13:09.835556-0500 MY_APP[4327:313598] Tag scheme TokenType

Can anyone help explain to me why I cannot access the other schemes? In particular I am looking to be able to use the NSLinguisticTagSchemeLexicalClass with NSLinguisticTagger. Currently this issue is causing the tagger to tag any word as (OtherWord), instead of it's true part of speech.

Any help would be appreciated..

UPDATE

ALL physical devices give me the same results - only three available schemes... I am at a loss here.


回答1:


After tireless research, sleepless nights, and three trips to the ward, I found out the problem. While the fix was by all means the poor man's solution, it worked nonetheless.


For whatever reason my iPhone 6s iOS 11.2.5 didn't feel like installing all of the available linguistic schemes when I originally set up my phone? Either that or it decided to remove them one day when it was bored.

Regardless, the solution was... drum roll...

Uninstall the target language...then reinstall it.


I guess this "reset" the language package to re-include these schemes. Happy codinggg




回答2:


The WWDC presentation covering this topic shows that far from all languages are supported for all schemes. In fact, several schemes are only supported for the following languages:

  • English
  • French
  • Italian
  • German
  • Portuguese
  • Russian
  • Turkish

If you download the slides on the linked page below you can see a table of this on slide 136.

When I run your code on my devices they all report the full set that you got on the simulator for en. With other language codes I get less. Did you check your iOS versions on your devices vs simulator?

WWDC 2017:208 - Natural Language Processing and your Apps



来源:https://stackoverflow.com/questions/48768919/device-vs-simulator-linguistic-schemes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!