使用在Android和Windows中执行的Ionic应用程序.
有一些服务,例如Ionic $ionicLoading,我们覆盖功能以便在Windows中正常工作:
angular.factory('$ionicLoading', function(){
return {
show: function (){...} // custom implementation
hide: function (){...} // custom implementation
}
});
Run Code Online (Sandbox Code Playgroud)
但是我们必须覆盖其他服务,只是为了不破坏应用程序.在这种情况下,提供不会做任何事情的服务将非常有用.例如:
angular.factory('$ionicExampleService', function(){
return {
*foo*: angular.noop // for operations
*bar*: promise // returns promise
}
});
Run Code Online (Sandbox Code Playgroud)
注意:我知道更好的方法是使用在Ionic实现或制作之间选择的服务,但这只是为了学习.
理想情况会更进一步,能够返回更加防弹的东西会很棒.像通用的灵活服务:
angular.factory('$ionicPopup', function(){
return /*magic*/;
});
$ionicPopup.show({...}) // show was not defined
.then(foo); // won't break and will execute foo()
Run Code Online (Sandbox Code Playgroud)
有可能的?
我正在使用Scikit-learn来聚集关于#oscars的推文(仅文本).
如果@LeonardoDiCaprio之类的用户名或#redcarpet之类的标签可以被认为在预处理中更重要,那将非常有用.
我想知道是否可以为这些常用用户名和主题标签添加更多权重,以便成为更重要的功能.
python cluster-analysis machine-learning feature-selection scikit-learn