小编Luc*_*ang的帖子

了解scikit CountVectorizer中的min_df和max_df

我有五个文本文件,我输入到CountVectorizer.将min_df和max_df指定给CountVectorizer实例时,min/max文档频率的确切含义是什么?它是特定文本文件中单词的频率,还是整个语料库中单词的频率(5个txt文件)?

当min_df和max_df以整数或浮点数形式提供时,它有何不同?

该文档似乎没有提供详尽的解释,也没有提供示例来演示min_df和/或max_df的使用.有人可以提供演示min_df或max_df的解释或示例.

python nlp machine-learning scikit-learn

62
推荐指数
4
解决办法
4万
查看次数

使用Swift删除iOS目录中的文件

我在我的应用程序中下载了一些PDF文件,并希望在关闭应用程序时删除这些文件.

由于某种原因,它不起作用:

创建文件:

let reference = "test.pdf"    
let RequestURL = "http://xx/_PROJEKTE/xx\(self.reference)"
let ChartURL = NSURL(string: RequestURL)

//download file
let documentsUrl =  NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first! as NSURL
let destinationUrl = documentsUrl.URLByAppendingPathComponent(ChartURL!.lastPathComponent!)
if NSFileManager().fileExistsAtPath(destinationUrl.path!) {
    print("The file already exists at path")
} else {
    //  if the file doesn't exist
    //  just download the data from your url
    if let ChartDataFromUrl = NSData(contentsOfURL: ChartURL!){
        // after downloading your data you need to save it to your destination url
        if ChartDataFromUrl.writeToURL(destinationUrl, atomically: true) …
Run Code Online (Sandbox Code Playgroud)

ios swift

25
推荐指数
3
解决办法
4万
查看次数

如何向OpenTok视频添加核心图像过滤器?

当我在iOS上发布流时,TokBox使用默认摄像头.有没有办法向发布者添加实时过滤器?

我只想要一些关于如何创建过滤器并将其附加到opentok发布者对象(OTVideoCapture)的简单示例代码.

或者,如果这不是正确的方法...在订户端附加过滤器也可以.

怎么能轻松完成?

image ios tokbox opentok swift

20
推荐指数
1
解决办法
686
查看次数

获取UIPageViewController的滚动位置

我正在使用a UIPageViewController,我需要在用户滑动时获取ViewController的滚动位置,这样我可以在视图转换到下一个视图时部分淡化某些资源UIViewController.

委托和数据源方法UIPageViewController似乎没有提供对此的任何访问,并在内部我假设UIPageViewController必须在某处使用滚动视图,但它似乎没有直接子类化它所以我不能呼叫

func scrollViewDidScroll(scrollView: UIScrollView) {

}
Run Code Online (Sandbox Code Playgroud)

我已经看到一些其他帖子建议获取引用pageViewController!.view.subviews然后第一个索引是一个scrollView,但这似乎非常 hacky.我想知道是否有更标准的方法来处理这个问题.

ios swift

18
推荐指数
3
解决办法
1万
查看次数

TokBox OpenTok替代品?

我想在我的网站上提供视频聊天,并想知道是否有人可以推荐一个API /服务,让我这样做.我熟悉OpenTok,但不喜欢它使用Flash.此外,音频往往有很多噪音/反馈 - 除非你戴着耳机.

建议?

编辑:

我现在正在将它用于P2P,但是希望将来能够进行群组视频聊天.

Flash是我主要关心的问题之一.当我使用OpenTok时,我注意到Flash有时会崩溃.虽然Flash也会在其他时间崩溃 - 但在将其用于OpenTok时似乎更频繁.我理解Flash有它的好处(对我来说最重要的是我几乎可以指望我的用户拥有它),但我想尽可能探索其他选项.Flash应该是一种垂死的技术?

音频是另一个主要问题.通常会出现回声和明显的延迟.使用相同的设置(互联网连接,计算机,麦克风/扬声器等)并将其与Skype进行比较,显然Skype更加优越.

玩家是我最后的关注点.以下是我不喜欢的事情:

  • 我无法删除链接到OpenTok的左上角图标.因此,这不是我能真正白色标签的东西.
  • 播放器具有音量控制功能,但不支持视频控制(例如停止发布,停止订阅).相反,我被迫通过API实现自己的.尽管API使其变得相当容易,但我认为不应该这样做.应提供视频控制,就像音量控制一样.

api videochat video-conferencing tokbox opentok

16
推荐指数
2
解决办法
1万
查看次数

在Swift中注册远程通知时未收到设备令牌

注册远程通知时,我以某种方式无法接收设备令牌.我得到模式说"你想让App X能够发送给你通知",但是当我接受它时,不会调用didRegisterForRemoteNotifications函数.

当我使用以下代码在iOS 8/Swift中注册远程通知时:

    UIApplication.sharedApplication().registerForRemoteNotifications()
    let settings = UIUserNotificationSettings(forTypes: UIUserNotificationType.Badge | UIUserNotificationType.Alert | UIUserNotificationType.Sound, categories: nil)
    UIApplication.sharedApplication().registerUserNotificationSettings(settings)
    UIApplication.sharedApplication().registerForRemoteNotifications()
Run Code Online (Sandbox Code Playgroud)

这些功能根本没有被触发:

   func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData!) 
Run Code Online (Sandbox Code Playgroud)

func application(application: UIApplication,    didFailToRegisterForRemoteNotificationsWithError error: NSError!) 
Run Code Online (Sandbox Code Playgroud)

但是当我记录这个

println("current settings \(UIApplication.sharedApplication().currentUserNotificationSettings()) and \(UIApplication.sharedApplication().isRegisteredForRemoteNotifications())")
Run Code Online (Sandbox Code Playgroud)

我收到

"current settings <UIUserNotificationSettings: 0x170437120; types: (UIUserNotificationTypeAlert UIUserNotificationTypeBadge UIUserNotificationTypeSound);> and true" 
Run Code Online (Sandbox Code Playgroud)

我的配置文件和证书都按顺序排列.

有其他人有这个问题吗?

apple-push-notifications ios swift

11
推荐指数
1
解决办法
3万
查看次数

CLGeocoder如何设置超时?

我试图通过CLLocation结构定义城市名称,反向...方法请求CLGeocoder对象,但我不知道如何设置超时?如果没有互联网连接请求时间可能需要大约30秒 - 这太长了...

objective-c ios

9
推荐指数
1
解决办法
616
查看次数

在Xcode 7中,iOS 9"应用程序窗口应该在应用程序启动结束时具有根视图控制器"

我的控制台出错并崩溃了.

“Application windows are expected to have a root view controller at the end of application launch”  
Run Code Online (Sandbox Code Playgroud)

下面是我的一段代码,在输入返回YES行后会发生崩溃.

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    

    UIImageView *defaultImage = [[UIImageView alloc] initWithImage:splashImage];
    defaultImage.frame = defaultImageFrame;
    [self.window addSubview:defaultImage];

    [NSTimer scheduledTimerWithTimeInterval:3.0 target:self
                                   selector:@selector(login:)
                                   userInfo:nil
                                    repeats:NO];
    [self.window setBackgroundColor:[UIColor clearColor]];
    [self.window makeKeyAndVisible];


    return YES; // here crash will happens
}


-(void)login:(id)sender
{
   PreLoginViewController *appController = [[PreLoginViewController alloc] initWithNibName:nil bundle:nil];
            if (_ChooseLogin.isStatus == 105)
            {
                flagRequired = @"1";
                appController.serverDownFlag = @"1";
            }
            appController.termsURL = _ChooseLogin.urlString;

            appController._ChooseLogin = …
Run Code Online (Sandbox Code Playgroud)

objective-c ios

8
推荐指数
1
解决办法
3529
查看次数

如何处理GPUImage图像缓冲区,以便它们可以用于像Tokbox这样的东西?

我正在使用OpenTok并用我自己的包含GPUImage的子类版本替换了他们的Publisher.我的目标是添加过滤器.

应用程序构建并运行,但崩溃在这里:

   func willOutputSampleBuffer(sampleBuffer: CMSampleBuffer!) {
        let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)
        CVPixelBufferLockBaseAddress(imageBuffer!, 0)
        videoFrame?.clearPlanes()
        for var i = 0 ; i < CVPixelBufferGetPlaneCount(imageBuffer!); i++ {
            print(i)
            videoFrame?.planes.addPointer(CVPixelBufferGetBaseAddressOfPlane(imageBuffer!, i))
        }
        videoFrame?.orientation = OTVideoOrientation.Left
        videoCaptureConsumer.consumeFrame(videoFrame) //comment this out to stop app from crashing. Otherwise, it crashes here.
        CVPixelBufferUnlockBaseAddress(imageBuffer!, 0)
    }
Run Code Online (Sandbox Code Playgroud)

如果我评论该行,我就可以运行应用程序而不会崩溃.事实上,我看到过滤器正确应用,但它正在闪烁.Nothings发布到Opentok.

我的整个代码库都可以下载.单击此处查看特定文件:这是该类的特定文件.它实际上很容易运行 - 只需在运行之前进行pod安装.

经过检查,可能videoCaptureConsumer是没有初始化.协议参考

我不知道我的代码意味着什么.我直接从这个客观的C文件中翻译了它:Tokbox的示例项目

ios gpuimage tokbox opentok swift

7
推荐指数
1
解决办法
1416
查看次数

OpenTok Android演示无法正常工作 - 没有找到类"com.opentok.helloworld.MainActivity"

我一直试图让OpenTok Android hello世界正常运行,但它一直在发布时崩溃.导入Hello world项目后,我将opentok android sdk复制到项目中并在eclipse中重新构建项目.错误全部消失但是当我在我的Galaxy Nexus上运行时,我收到以下错误:

02-02 10:01:39.321: E/AndroidRuntime(17238): FATAL EXCEPTION: main
02-02 10:01:39.321: E/AndroidRuntime(17238): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.opentok.helloworld/com.opentok.helloworld.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.opentok.helloworld.MainActivity" on path: /data/app/com.opentok.helloworld-2.apk
02-02 10:01:39.321: E/AndroidRuntime(17238):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
02-02 10:01:39.321: E/AndroidRuntime(17238):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-02 10:01:39.321: E/AndroidRuntime(17238):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-02 10:01:39.321: E/AndroidRuntime(17238):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-02 10:01:39.321: E/AndroidRuntime(17238):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-02 10:01:39.321: E/AndroidRuntime(17238):    at android.os.Looper.loop(Looper.java:137)
02-02 10:01:39.321: E/AndroidRuntime(17238):    at android.app.ActivityThread.main(ActivityThread.java:5039)
02-02 10:01:39.321: E/AndroidRuntime(17238):    at java.lang.reflect.Method.invokeNative(Native Method)
02-02 10:01:39.321: E/AndroidRuntime(17238):    at java.lang.reflect.Method.invoke(Method.java:511)
02-02 10:01:39.321: E/AndroidRuntime(17238): …
Run Code Online (Sandbox Code Playgroud)

eclipse android tokbox opentok

5
推荐指数
1
解决办法
1817
查看次数